config

package
v0.7.21 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config handles loading, validation, and watching of aviary.yaml.

Index

Constants

View Source
const (
	ProjectReportMerged  = "merged"
	ProjectReportFailed  = "failed"
	ProjectReportWaiting = "waiting"
)

Project report events.

View Source
const (
	DefaultProjectsConcurrency = 3
	DefaultProjectsInterval    = 30 * time.Second
	// DefaultProjectsBrowserInterval is browser delivery's poll interval.
	DefaultProjectsBrowserInterval = 20 * time.Second
	DefaultProjectsDelivery        = "browser"
	DefaultProjectsFilter          = "assignee:@me"
	DefaultProjectsWebhookPath     = "/webhook"
)

Code Loop defaults, applied by the consuming code so they never reach the YAML file.

View Source
const (
	ProjectModelSourceOverride = "project override"
	ProjectModelSourceDefaults = "from models.defaults"
)

Sources of a project's job model, as ProjectModelSource reports them.

View Source
const (
	// CodeLoopResume resumes a paused job when output arrives instead of
	// queuing the output until the job runs again.
	CodeLoopResume = "resume"
	// CodeLoopReopen retries a completed job with the output instead of
	// rejecting it.
	CodeLoopReopen = "reopen"
)

The delivery options of a Code Loop target.

View Source
const (
	TargetSilent   = "silent"
	TargetReply    = "reply"
	TargetSession  = "session"
	TargetChannel  = "channel"
	TargetCodeLoop = "codeloop"
)

The kinds of task and workflow delivery targets.

View Source
const ChannelTargetPrefix = "channel:"

ChannelTargetPrefix starts a delivery target that names a channel: "channel:<name>". A task, report or notification sent there lands in the channel's own session.

View Source
const CodeLoopTargetPrefix = "codeloop:"

CodeLoopTargetPrefix starts a delivery target that names a Code Loop job: "codeloop:<project>#<number>", where project is the job's watch target as configured (OWNER/REPO or a GitHub project URL) and number its issue. The number may be followed by "?" and comma-separated delivery options: CodeLoopResume and CodeLoopReopen.

View Source
const DefaultCDPPort = 9222

DefaultCDPPort is the default Chrome DevTools Protocol port used when not set in config.

View Source
const DefaultFailedTaskTimeout = 6 * time.Hour

DefaultFailedTaskTimeout is used when failed_task_timeout is not set in config.

View Source
const DefaultGroupChatHistory = 50

DefaultGroupChatHistory is the default number of group chat messages retained in the chat log and provided as context to the agent.

View Source
const DefaultServerPort = 16677

DefaultServerPort is the port the server listens on when server.port is unset.

View Source
const DefaultTaskIdleTimeout = 15 * time.Minute

DefaultTaskIdleTimeout is how long a task run may go without output when its idle_timeout is not set.

View Source
const ProjectsAgentName = "projects"

ProjectsAgentName is the built-in Aviary agent behind the Code Loop board's prompt chat. An agent of the same name in aviary.yaml replaces it.

View Source
const ProjectsAgentRules = `` /* 3265-byte string literal not displayed */

ProjectsAgentRules are the Code Loop agent's operating rules.

View Source
const ProjectsChatSession = "projects-chat"

ProjectsChatSession is the Code Loop agent's one prompt chat session, shared by every board and hidden from the Chats list.

View Source
const ReplyTarget = "reply"

ReplyTarget is a workflow's delivery target that answers in the conversation whose message triggered the run.

View Source
const TriggerMessage = "message"

TriggerMessage is the trigger of a workflow: a task that runs when a matching message arrives on one of its agent's channels.

Variables

ProjectReportEvents are the job events a project can report.

View Source
var ProjectsAgentTools = []string{
	"project_status",
	"project_job_list",
	"project_job_get",
	"project_job_explain",
	"project_job_retry",
	"project_job_pause",
	"project_job_resume",
	"project_job_stop",
	"project_job_dismiss",
	"project_refresh",
	"provider_cli_list",
	"project_clone_list",
	"project_unblock_run",
	"project_issue_comment",
	"project_issue_create",
}

ProjectsAgentTools are the only tools the Code Loop agent may call. It reads live state, retries, pauses, resumes or stops jobs, runs unblock rounds, files issues, and updates an issue or pull request with project_issue_comment: one comment mentioning its author, which the job working it also hears. Adding or removing projects and clearing clones stay with the user.

Functions

func AgentTasksDir

func AgentTasksDir(agentCfg AgentConfig) string

AgentTasksDir returns the tasks/ directory under the agent's Aviary data directory. Task definitions are always stored with the agent metadata rather than in the agent's working directory.

func BaseDir

func BaseDir() string

BaseDir returns the Aviary config base directory. If AVIARY_CONFIG_BASE_DIR is set, it takes precedence. Otherwise it is the parent directory containing aviary.yaml.

func BoolOr

func BoolOr(b *bool, def bool) bool

BoolOr returns the value of b if non-nil, otherwise def.

func CLIBackends added in v0.7.0

func CLIBackends(cfg *Config) []cliagent.Backend

CLIBackends returns the CLI backends referenced by any agent model, fallback, or model default.

func CLIBuiltinToolsAllowed added in v0.7.0

func CLIBuiltinToolsAllowed(perms *PermissionsConfig) bool

CLIBuiltinToolsAllowed reports whether a CLI-backed agent may use the CLI's own shell, file-edit and web tools: only with the full preset and an explicit cli_builtin_tools opt-in.

func ChannelTarget added in v0.7.1

func ChannelTarget(name string) string

ChannelTarget returns the delivery target that picks the channel named name.

func ChannelTargetName added in v0.7.1

func ChannelTargetName(target string) (string, bool)

ChannelTargetName returns the channel name a "channel:<name>" target picks, and whether target is one.

func ClampToolNamesForPreset

func ClampToolNamesForPreset(preset PermissionsPreset, names []string) []string

ClampToolNamesForPreset filters tool names to those accessible under preset.

func CodeLoopTarget added in v0.7.8

func CodeLoopTarget(project string, number int) string

CodeLoopTarget returns the delivery target that picks project's job number.

func DefaultPath

func DefaultPath() string

DefaultPath returns the default path to aviary.yaml.

func EffectiveAgentFallbacks

func EffectiveAgentFallbacks(agent AgentConfig, models ModelsConfig) []string

EffectiveAgentFallbacks returns the runtime fallback list for an agent, preferring the agent-specific list and otherwise using models.defaults.fallbacks.

func EffectiveAgentModel

func EffectiveAgentModel(agent AgentConfig, models ModelsConfig) string

EffectiveAgentModel returns the runtime model for an agent, preferring the agent-specific value and falling back to models.defaults.model.

func EffectiveBrowserReuseTabs added in v0.3.2

func EffectiveBrowserReuseTabs(b BrowserConfig) bool

EffectiveBrowserReuseTabs returns whether browser_open should reuse an existing tab whose URL exactly matches the requested URL. Defaults to true when unset.

func EffectiveCodingSkillsAutoUpdate added in v0.7.0

func EffectiveCodingSkillsAutoUpdate(cfg *Config) bool

EffectiveCodingSkillsAutoUpdate reports whether outdated skills Aviary ships are reinstalled automatically. Defaults to true when unset.

func EffectiveCodingSkillsInstallNewCLIs added in v0.7.0

func EffectiveCodingSkillsInstallNewCLIs(cfg *Config) bool

EffectiveCodingSkillsInstallNewCLIs reports whether the skills Aviary ships are installed for CLIs found later. Defaults to true when unset.

func EffectivePrecomputeTasks

func EffectivePrecomputeTasks(s SchedulerConfig) bool

EffectivePrecomputeTasks returns whether prompt tasks should be precompiled before scheduling. The default is true when the setting is unset.

func EffectiveServerAutoUpdate added in v0.7.1

func EffectiveServerAutoUpdate(cfg *Config) bool

EffectiveServerAutoUpdate reports whether new releases install automatically. Defaults to true when unset.

func EffectiveServerExternalAccess added in v0.3.8

func EffectiveServerExternalAccess(s ServerConfig) bool

EffectiveServerExternalAccess returns whether the server should bind to 0.0.0.0 instead of localhost. Resolution order is: 1. AVIARY_CONFIG_SERVER_EXTERNAL_ACCESS environment variable 2. server.external_access from aviary.yaml 3. default false

func EffectiveServerNoTLS added in v0.7.3

func EffectiveServerNoTLS(s ServerConfig) bool

EffectiveServerNoTLS returns whether the server serves plain HTTP. AVIARY_CONFIG_SERVER_NO_TLS overrides server.no_tls from aviary.yaml.

func EffectiveServerPort added in v0.7.13

func EffectiveServerPort(s ServerConfig) int

EffectiveServerPort returns the port the server listens on.

func FindMarkdownTask added in v0.7.0

func FindMarkdownTask(dir, name string) (string, error)

FindMarkdownTask returns the path of the task file in dir that defines the task named name.

func GetField

func GetField(cfg *Config, path string) string

GetField reads a dot-path value from cfg and returns its string representation. Returns "" for unset or zero fields.

func HasProject added in v0.7.8

func HasProject(agents []AgentConfig, project string) bool

HasProject reports whether any agent in agents owns project.

func IsReplyTarget added in v0.7.8

func IsReplyTarget(target string) bool

IsReplyTarget reports whether target is ReplyTarget.

func IsToolAllowedByPreset

func IsToolAllowedByPreset(preset PermissionsPreset, toolName string) bool

IsToolAllowedByPreset reports whether toolName may be enabled for preset.

func IsValidPermissionsPreset

func IsValidPermissionsPreset(preset PermissionsPreset) bool

IsValidPermissionsPreset reports whether preset is a recognized preset value.

func LegacyTaskModel added in v0.7.0

func LegacyTaskModel(specs ...string) string

LegacyTaskModel returns the model override a project task stored under one of its old keys holds: run_agent, or cli before #501, whichever is set first. Both held a CLI provider's model spec. One naming a model ("claude/opus") is already that CLI's model; a bare CLI ("codex") is the model cli/codex, as an agent's model names it.

func NormalizeProjectModel added in v0.7.15

func NormalizeProjectModel(models ModelsConfig, model string) string

NormalizeProjectModel trims a projects.model or projects.fallbacks entry and turns the provider:model shorthand, such as claude:opus, into the claude/opus form models use everywhere else. A model that already names a provider with a slash, such as codex/gpt-5.6:high, is left alone.

func ProjectCLIProviders added in v0.7.9

func ProjectCLIProviders(cfg *Config, agentName, target string, models []string) []string

ProjectCLIProviders returns the CLI providers, sorted, that a project owned by the named agent uses, so its skills only need installing for those: the CLIs of the jobs' models (projects.model and projects.fallbacks when model is set, else models, when non-nil, in place of the agent's saved model and fallbacks, as ProjectJobSpecs maps them), the Code Loop chat agent's model and fallbacks, the unblock agent, and the model of every scheduled task targeting the project.

func ProjectJobSpecs added in v0.7.0

func ProjectJobSpecs(cfg *Config, agentName string) []string

ProjectJobSpecs returns the model specs, in fallback order, that jobs of a project owned by the named agent run on: projects.model and projects.fallbacks when model is set, else the agent's model and fallbacks, after models.defaults, each CLI provider model as its spec: cli/claude/opus and claude/opus are both the spec claude/opus. A model that is not a CLI runs the job on the agent itself, as aviary/<agent>. An empty name, a runtime watch no agent owns, takes the CLI models of models.defaults, as an agent without a model would. It returns nil when the named agent is not configured.

func ProjectModelSource added in v0.7.15

func ProjectModelSource(cfg *Config, agentName string) string

ProjectModelSource says where the models of ProjectJobSpecs come from: "project override", "from agent <name>", or "from models.defaults" for a runtime watch no agent owns.

func ProjectModelSpec added in v0.7.0

func ProjectModelSpec(cfg *Config, agentName, model string) (spec, override string, ok bool)

ProjectModelSpec returns the model spec that runs a job of a project owned by the named agent with model overriding the agent's own, as ProjectJobSpecs maps the agent's model: a CLI provider model runs as its spec, and any other model runs on the agent itself, as aviary/<agent>, with the model returned as override for that turn. It reports false for a model that is not a CLI when the project is owned by no agent to run it on.

func RestoreLatestBackup

func RestoreLatestBackup(path string) error

RestoreLatestBackup copies the newest rotating backup (aviary.yml.bak.1) back to the live config path.

func Save

func Save(path string, cfg *Config) error

Save writes cfg to path as YAML (creating parent directories as needed). If path is empty, DefaultPath() is used.

func SaveMarkdownTask

func SaveMarkdownTask(dir string, task TaskConfig) (string, error)

SaveMarkdownTask writes task as a markdown file inside dir. The filename is derived from task.Name. Returns the full path of the written file.

func Schema

func Schema() []byte

Schema returns the raw JSON schema bytes.

func ServerURL added in v0.7.13

func ServerURL(s ServerConfig) string

ServerURL returns the base URL local clients use to reach the server: https://localhost:<port>, or http:// when the server serves plain HTTP. Every internal client of the local server resolves its URL here, so none of them talks plain HTTP to the TLS listener or TLS to a plain one.

func SetDefaultPath added in v0.7.8

func SetDefaultPath(path string)

SetDefaultPath makes DefaultPath return path, so every load and save that names no file uses it. `aviary watch` points it at its temporary config. An empty path restores the automatic resolution.

func SetField

func SetField(cfg *Config, path, value string) error

SetField writes a dot-path field in cfg from the string value. Pointer fields are auto-initialized when non-empty values are set. Returns an error when the type conversion fails.

func ToolGroup

func ToolGroup(name string) string

ToolGroup returns the logical tool group used by permissions presets and the UI.

func UniqueProviderModels

func UniqueProviderModels(cfg *Config) map[string]string

UniqueProviderModels returns a map of provider name → one representative model string (e.g. "anthropic" → "anthropic/claude-sonnet-5-5") drawn from all agents and model defaults. CLI provider models, "cli/..." and "<cli>/...", are excluded because they run through a local CLI rather than a remote endpoint; see CLIBackends.

func ValidateProjectModel added in v0.7.15

func ValidateProjectModel(models ModelsConfig, model string) error

ValidateProjectModel checks one projects.model or projects.fallbacks entry: it must be a model of a provider reached through a CLI, which is what Code Loop jobs run on, and that CLI must be installed.

func ValidateProjectModels added in v0.7.15

func ValidateProjectModels(models ModelsConfig, p ProjectsConfig) error

ValidateProjectModels checks projects.model and projects.fallbacks as ValidateProjectModel does, and that fallbacks come with a model.

Types

type AgentConfig

type AgentConfig struct {
	Name         string   `yaml:"name"                    json:"name"`
	Model        string   `yaml:"model"                   json:"model"`
	Fallbacks    []string `yaml:"fallbacks,omitempty"     json:"fallbacks,omitempty"`
	Memory       string   `yaml:"memory,omitempty"        json:"memory,omitempty"`
	MemoryTokens int      `yaml:"memory_tokens,omitempty" json:"memory_tokens,omitempty"`
	CompactKeep  int      `yaml:"compact_keep,omitempty"  json:"compact_keep,omitempty"`
	// WorkingDir is the default working directory for this agent. When set it
	// overrides the process working directory for file-path resolution and
	// filesystem-policy base-dir expansion.  Supports ~ and environment
	// variable expansion.  Defaults to the process working directory.
	WorkingDir string `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
	// Rules is an optional set of operating rules injected at the top of every
	// system prompt for this agent.  It may be inline markdown text or a path
	// to a file (e.g. "./RULES.md"); file paths are resolved relative to the
	// agent working directory at prompt time.
	Rules       string             `yaml:"rules,omitempty"       json:"rules,omitempty"`
	Permissions *PermissionsConfig `yaml:"permissions,omitempty" json:"permissions,omitempty"`
	Channels    []ChannelConfig    `yaml:"channels,omitempty"    json:"channels,omitempty"`
	Tasks       []TaskConfig       `yaml:"tasks,omitempty"       json:"tasks,omitempty"`
	// Projects are the GitHub projects this agent owns. A project belongs to
	// exactly one agent, whose model and fallbacks run its jobs; the
	// settings are the shared top-level projects: section.
	Projects AgentProjectsConfig `yaml:"projects,omitempty" json:"projects,omitzero"`
	// Verbose enables progress status messages before each tool call when the
	// agent is responding via a channel (Slack, Signal, etc.). When true the
	// agent emits a brief "I am doing X..." message before executing each tool,
	// allowing channels that do not support real-time streaming to display
	// incremental updates by sending or editing a status message.
	Verbose *bool `yaml:"verbose,omitempty" json:"verbose,omitempty"`
}

AgentConfig describes a single agent.

func EffectiveAgents added in v0.7.0

func EffectiveAgents(cfg *Config) []AgentConfig

EffectiveAgents returns the configured agents followed by the built-in Code Loop agent, unless an agent in aviary.yaml already uses its name.

func ProjectsAgent added in v0.7.0

func ProjectsAgent(p ProjectsConfig) AgentConfig

ProjectsAgent returns the built-in Code Loop agent's configuration.

func (AgentConfig) ChannelByKey added in v0.7.1

func (a AgentConfig) ChannelByKey(channelType, id string) int

ChannelByKey returns the index of the agent's channel with this type and ID, or -1.

func (AgentConfig) ChannelByName added in v0.7.1

func (a AgentConfig) ChannelByName(name string) int

ChannelByName returns the index of the agent's channel named name, matched case-insensitively, or -1.

func (AgentConfig) ChannelForSession added in v0.7.1

func (a AgentConfig) ChannelForSession(sessionName, channelType, configuredID string) int

ChannelForSession returns the index of the channel that owns the session named sessionName, given the configured channel it delivers through (configuredID, empty when unknown), or -1. A channel owns its own session and the conversations it receives ("<type>:<conversation>"). Without a configured ID, a conversation belongs to the agent's only channel of its type.

type AgentProjectsConfig added in v0.7.0

type AgentProjectsConfig []ProjectConfig

AgentProjectsConfig is an agent's projects: list in aviary.yaml: the projects the agent owns, which are repositories, project boards and Discussions boards. Their settings are the shared top-level projects: section.

func (AgentProjectsConfig) IsZero added in v0.7.0

func (p AgentProjectsConfig) IsZero() bool

IsZero reports whether the section holds nothing, so Save leaves it out.

func (AgentProjectsConfig) Targets added in v0.7.0

func (p AgentProjectsConfig) Targets() []string

Targets returns every watched target, in order, without duplicates.

type AllowFromEntry

type AllowFromEntry struct {
	// Enabled controls whether this allowFrom entry is active. Defaults to true.
	Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	// From is a comma-separated list of sender IDs.
	From string `yaml:"from" json:"from"`
	// AllowedGroups is a comma-separated list of group/channel IDs that this
	// entry permits.  Use "*" to allow any group.  When empty (the default) the
	// entry only matches direct messages.
	AllowedGroups string `yaml:"allowed_groups,omitempty" json:"allowed_groups,omitempty"`
	// MentionPrefixes is a list of glob patterns matched against the message
	// text in group chats.  At least one must match for the message to be
	// forwarded (unless RespondToMentions is true and the bot is mentioned).
	MentionPrefixes []string `yaml:"mention_prefixes,omitempty" json:"mention_prefixes,omitempty"`
	// ExcludePrefixes is a list of glob patterns matched against the message
	// text.  If any pattern matches, the message is silently dropped regardless
	// of other rules.  Applies to both direct messages and group messages.
	ExcludePrefixes []string `yaml:"exclude_prefixes,omitempty" json:"exclude_prefixes,omitempty"`
	// RespondToMentions, when true, also forwards group messages that directly
	// mention the bot.  On Slack and Discord this checks for platform @mention
	// syntax (e.g. <@BOTID>).  On Signal this uses the envelope's wasMentioned
	// field provided by signal-cli.
	RespondToMentions bool `yaml:"respond_to_mentions,omitempty" json:"respond_to_mentions,omitempty"`
	// MentionPrefixGroupOnly controls whether MentionPrefixes and
	// RespondToMentions filtering is restricted to group chats only.
	// Defaults to true (current behaviour). Set to false to also require a
	// mention prefix in direct messages; DMs without a matching prefix are
	// then silently dropped even when the sender is in the allow-list.
	MentionPrefixGroupOnly *bool `yaml:"mention_prefix_group_only,omitempty" json:"mention_prefix_group_only,omitempty"`
	// RestrictTools overrides the agent's tool allow-list for messages that
	// match this entry.  When non-empty only the listed tools are available;
	// an absent or empty slice falls back to the agent-level permissions.
	RestrictTools []string `yaml:"restrict_tools,omitempty" json:"restrict_tools,omitempty"`
	// Model overrides the agent's default model for messages matching this entry.
	Model string `yaml:"model,omitempty" json:"model,omitempty"`
	// Fallbacks overrides the agent's default fallbacks for messages matching this entry.
	Fallbacks []string `yaml:"fallbacks,omitempty" json:"fallbacks,omitempty"`
}

AllowFromEntry defines a set of allowed senders and optional group-chat filtering settings that apply when a message matches this entry.

The From field is a comma-separated list of sender IDs:

  • A phone number (Signal) or user ID (Slack/Discord), e.g. "+15551234567"
  • "*" to match any sender (DMs or groups, combined with AllowedGroups for groups)

To allow group/channel messages, AllowedGroups must be set. When AllowedGroups is empty the entry only applies to direct messages.

MentionPrefixes and RespondToMentions apply to group messages by default. Set MentionPrefixGroupOnly to false to also require a matching prefix in direct messages; when false, DMs from allowed senders must still match a MentionPrefixes pattern or trigger RespondToMentions to be forwarded. For direct-message IDs all messages from the matched sender are forwarded without further filtering when MentionPrefixGroupOnly is true (the default).

For YAML backward compatibility a plain string entry is equivalent to AllowFromEntry{From: "<string>"}.

func (*AllowFromEntry) UnmarshalJSON

func (e *AllowFromEntry) UnmarshalJSON(b []byte) error

UnmarshalJSON lets a plain JSON string act as AllowFromEntry{From: "<string>"} for backward compatibility with the old []string allowFrom format.

func (*AllowFromEntry) UnmarshalYAML

func (e *AllowFromEntry) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML lets a plain YAML string act as AllowFromEntry{From: "<string>"} for backward compatibility with the old []string allowFrom format.

type ApprovalConfig added in v0.7.0

type ApprovalConfig struct {
	// Mode is the general setting, used by every surface without an
	// override of its own. Empty means clidefs.DefaultApprovalMode.
	Mode clidefs.ApprovalMode `yaml:"mode,omitempty" json:"mode,omitempty"`
	// Chat overrides Mode for agent chat turns run through a CLI provider:
	// the web UI chat, including the Code Loop board's prompt chat. Empty
	// follows Mode.
	Chat clidefs.ApprovalMode `yaml:"chat,omitempty" json:"chat,omitempty"`
}

ApprovalConfig is the approval: section of aviary.yaml: how much a CLI provider may do without asking, in Aviary's own terms. Every CLI launch translates its surface's effective mode into that CLI's native permission flags (see clidefs.Definition.ApprovalArgs); no CLI settings file is written to set it.

type BrowserConfig

type BrowserConfig struct {
	Binary  string `yaml:"binary,omitempty"            json:"binary,omitempty"`
	CDPPort int    `yaml:"cdp_port,omitempty"          json:"cdp_port,omitempty"`
	// ProfileDir is the Chrome user data directory path.
	// Defaults to <OS config dir>/aviary/browser if unset.
	ProfileDir string `yaml:"profile_directory,omitempty" json:"profile_directory,omitempty"`
	Headless   bool   `yaml:"headless,omitempty"          json:"headless,omitempty"`
	ReuseTabs  *bool  `yaml:"reuse_tabs,omitempty"        json:"reuse_tabs,omitempty"`
}

BrowserConfig holds browser control settings.

type ChannelConfig

type ChannelConfig struct {
	Enabled *bool  `yaml:"enabled,omitempty"         json:"enabled,omitempty"`
	Type    string `yaml:"type"                    json:"type"`
	Token   string `yaml:"token,omitempty"         json:"token,omitempty"`
	// ID is the channel's stable key within its agent and type. Its own
	// session is keyed by it, so renaming the channel keeps that session.
	ID string `yaml:"id,omitempty"            json:"id,omitempty"`
	// Name is the channel's display name in the sidebar and the name
	// delivery targets pick it by ("channel:<name>"). Empty means the ID.
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
	// DeliverTo is the conversation the channel's own session sends to: a
	// Slack or Discord channel ID, or a Signal phone number or group ID.
	// Messages delivered to the channel by name land in that session and go
	// out here. Empty keeps them in Aviary only.
	DeliverTo string `yaml:"deliver_to,omitempty" json:"deliver_to,omitempty"`
	// Primary optionally identifies the configured sender ID of the "primary"
	// person for this channel (for example a Signal phone number or a Slack/
	// Discord user ID). When set, messages originating from this ID will be
	// annotated as coming from the primary person in historical context
	// displays.
	Primary       string           `yaml:"primary,omitempty"       json:"primary,omitempty"`
	URL           string           `yaml:"url,omitempty"           json:"url,omitempty"`
	AllowFrom     []AllowFromEntry `yaml:"allow_from,omitempty"     json:"allow_from,omitempty"`
	DisabledTools []string         `yaml:"disabled_tools,omitempty" json:"disabled_tools,omitempty"`
	// ShowTyping controls whether a typing indicator is shown while the agent
	// processes a message. Defaults to true for channels that support it.
	// Currently this is implemented for Signal only.
	ShowTyping *bool `yaml:"show_typing,omitempty"     json:"show_typing,omitempty"`
	// SeparateTopLevelSessions controls Slack channel session naming. When true,
	// every top-level Slack message gets its own session keyed by the Slack
	// thread/root timestamp, so all replies in that Slack thread share a session.
	SeparateTopLevelSessions *bool `yaml:"separate_top_level_sessions,omitempty" json:"separate_top_level_sessions,omitempty"`
	// ReactToEmoji controls whether the agent reacts to emoji reactions placed
	// on its own messages. On Signal, this treats the emoji as a prompt and
	// mirrors the same reaction back. Defaults to true for supported channels.
	ReactToEmoji *bool `yaml:"react_to_emoji,omitempty"   json:"react_to_emoji,omitempty"`
	// ReplyToReplies controls whether the agent responds when someone replies
	// to one of its own messages. Replies still have to match the entry's
	// sender/group allowFrom scope, but can continue the conversation without
	// re-satisfying mention-based group gating.
	// Defaults to true for channels that support it.
	ReplyToReplies *bool `yaml:"reply_to_replies,omitempty" json:"reply_to_replies,omitempty"`
	// SendReadReceipts controls whether the agent sends read receipts for
	// messages it will respond to. Read receipts are only sent for messages
	// that pass the allowFrom filter (i.e. messages the agent will act on).
	// Defaults to true for channels that support it.
	SendReadReceipts *bool `yaml:"send_read_receipts,omitempty" json:"send_read_receipts,omitempty"`
	// Model overrides the agent's default model for all messages on this channel.
	Model string `yaml:"model,omitempty" json:"model,omitempty"`
	// Fallbacks overrides the agent's default fallbacks for all messages on this channel.
	Fallbacks []string `yaml:"fallbacks,omitempty" json:"fallbacks,omitempty"`
	// GroupChatHistory is the number of recent group chat messages to log and
	// provide as context to the agent. 0 means use the default (50).
	// Set to -1 to disable group chat history logging entirely.
	GroupChatHistory int `yaml:"group_chat_history,omitempty" json:"group_chat_history,omitempty"`
}

ChannelConfig describes a communication channel for an agent.

func (ChannelConfig) EffectiveGroupChatHistory

func (c ChannelConfig) EffectiveGroupChatHistory() int

EffectiveGroupChatHistory returns the number of group chat messages to retain. Returns 0 if logging is disabled (GroupChatHistory == -1).

func (ChannelConfig) EffectiveName added in v0.7.1

func (c ChannelConfig) EffectiveName() string

EffectiveName returns the channel's display name: Name, else its ID, else its type.

func (ChannelConfig) SessionName added in v0.7.1

func (c ChannelConfig) SessionName() string

SessionName is the name of the channel's own session. It is keyed by the channel's type and ID, not its name, so a rename keeps the session.

type CodingSkillsConfig added in v0.7.0

type CodingSkillsConfig struct {
	// AutoUpdate reinstalls outdated skills at startup, so each release runs
	// the skills it was built with.
	AutoUpdate *bool `yaml:"auto_update,omitempty" json:"auto_update,omitempty"`
	// InstallNewCLIs installs the skills for any CLI provider found later.
	InstallNewCLIs *bool `yaml:"install_new_clis,omitempty" json:"install_new_clis,omitempty"`
}

CodingSkillsConfig controls the automatic upkeep of the skills Aviary ships. Both settings default to true when unset.

type Config

type Config struct {
	Server    ServerConfig    `yaml:"server"              json:"server"`
	Agents    []AgentConfig   `yaml:"agents,omitempty"    json:"agents,omitempty"`
	Models    ModelsConfig    `yaml:"models,omitempty"    json:"models,omitempty"`
	Browser   BrowserConfig   `yaml:"browser,omitempty"   json:"browser,omitempty"`
	Search    SearchConfig    `yaml:"search,omitempty"    json:"search,omitempty"`
	Scheduler SchedulerConfig `yaml:"scheduler,omitempty" json:"scheduler,omitempty"`
	// Transcription turns voice messages and composer recordings into text.
	Transcription TranscriptionConfig    `yaml:"transcription,omitempty" json:"transcription,omitzero"`
	Skills        map[string]SkillConfig `yaml:"skills,omitempty" json:"skills,omitempty"`
	// Approval is how much CLI providers may do without asking; see
	// ApprovalConfig.
	Approval ApprovalConfig `yaml:"approval,omitempty" json:"approval,omitzero"`
	// Projects is the one set of Code Loop settings, shared by every project
	// of every agent; the projects themselves are listed under the agents
	// that own them.
	Projects ProjectsConfig `yaml:"projects,omitempty" json:"projects,omitzero"`
	// CodingSkills controls how Aviary keeps the skills it ships for
	// providers (gh-fix, gh-discuss, gh-create, gh-safe-merge) installed and current.
	CodingSkills *CodingSkillsConfig `yaml:"coding_skills,omitempty" json:"coding_skills,omitempty"`
}

Config is the top-level configuration for Aviary.

func Default

func Default() Config

Default returns a Config populated with sensible defaults. Only fields that must be explicitly written to YAML are set here. Other defaults (CDPPort, Concurrency) live in the consuming code so that unset fields remain absent from the YAML file.

func Load

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

Load reads and parses the config file at path, then merges task definitions from each agent's tasks/ directory. If path is empty, DefaultPath() is used. Only fields present in the file are populated; unset fields remain zero so they are omitted from YAML on the next save. Consuming code applies its own runtime defaults (e.g. port 16677, CDP port 9222).

func (*Config) ChatApprovalMode added in v0.7.0

func (c *Config) ChatApprovalMode() clidefs.ApprovalMode

ChatApprovalMode is the effective approval mode of a CLI-backed chat turn.

func (*Config) ProjectList added in v0.7.0

func (c *Config) ProjectList() []ProjectConfig

ProjectList returns every agent's projects, in agent order.

func (*Config) ProjectOwner added in v0.7.0

func (c *Config) ProjectOwner(target string) string

ProjectOwner returns the name of the agent that owns target, or "" when no agent does.

func (*Config) ProjectOwners added in v0.7.0

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

ProjectOwners maps every watched target to the name of the agent that owns it. A target listed under several agents belongs to the first.

func (*Config) ProjectsApprovalMode added in v0.7.0

func (c *Config) ProjectsApprovalMode() clidefs.ApprovalMode

ProjectsApprovalMode is the effective approval mode of the CLI runs Code Loop launches.

func (*Config) ValidateProjectReports added in v0.7.0

func (c *Config) ValidateProjectReports(r *ProjectReportsConfig) error

ValidateProjectReports checks report settings against this config: the agent must exist, at least one target is needed, and every event must be one of ProjectReportEvents. Nil settings, meaning no reports, are valid.

type ExecPermissionsConfig

type ExecPermissionsConfig struct {
	AllowedCommands  []string `yaml:"allowed_commands,omitempty"  json:"allowed_commands,omitempty"`
	ShellInterpolate bool     `yaml:"shell_interpolate,omitempty" json:"shell_interpolate,omitempty"`
	Shell            string   `yaml:"shell,omitempty"            json:"shell,omitempty"`
}

ExecPermissionsConfig restricts host command execution for an agent. Rules are ordered glob patterns matched against the raw command string. A leading "!" negates a match. Rules are processed in order.

type FieldMeta

type FieldMeta struct {
	Path        string // dot-path, e.g. "server.tls.cert"
	Label       string // x-label from schema — short display name
	Placeholder string // x-placeholder — input hint / example value
	Description string // description — shown as help text
	Default     string // schema default rendered as a string for form hydration
	Type        string // "string" | "int" | "bool"
	Section     string // top-level config key: "server", "browser", etc.
	Order       int    // x-order within section; lower = first
}

FieldMeta describes a single configurable scalar field extracted from the JSON schema. Fields are identified by a dot-path that matches the yaml struct tags on Config (e.g. "server.port", "browser.headless").

func SectionFields

func SectionFields(section string) []FieldMeta

SectionFields returns the ordered FieldMeta slice for a config section. Use one of the top-level keys ("server", "browser", "scheduler", "search", "models") to get section-specific fields, or "general" to get all fields from every section in a stable section+order sequence.

type FilesystemPermissionsConfig

type FilesystemPermissionsConfig struct {
	AllowedPaths []string `yaml:"allowed_paths,omitempty" json:"allowed_paths,omitempty"`
}

FilesystemPermissionsConfig restricts file tool access to ordered allow/deny path rules. Rules use gitignore-style globbing and are processed in order.

type Issue

type Issue struct {
	Level   IssueLevel
	Field   string
	Message string
}

Issue is a single config validation finding.

func Validate

func Validate(cfg *Config, authGet func(key string) (string, error)) []Issue

Validate checks cfg for errors and warnings and returns all findings. authGet, if non-nil, is called to look up credentials from the auth store (key is the part after "auth:", e.g. "anthropic:default" or "slack_bot_token").

type IssueLevel

type IssueLevel string

IssueLevel indicates the severity of a validation finding.

const (
	LevelError   IssueLevel = "ERROR"
	LevelWarning IssueLevel = "WARN"
)

IssueLevel values.

type ModelDefaults

type ModelDefaults struct {
	Model     string   `yaml:"model,omitempty"     json:"model,omitempty"`
	Fallbacks []string `yaml:"fallbacks,omitempty" json:"fallbacks,omitempty"`
}

ModelDefaults holds default model settings.

type ModelsConfig

type ModelsConfig struct {
	Providers map[string]ProviderConfig `yaml:"providers,omitempty" json:"providers,omitempty"`
	Defaults  *ModelDefaults            `yaml:"defaults,omitempty"  json:"defaults,omitempty"`
	// CLIDefinitions overrides built-in CLI definitions field by field
	// and adds new ones, keyed by agent name. A null field drops it.
	// Providers reached through a CLI are like any other, so Code Loop reads
	// them from here rather than owning a registry of its own.
	CLIDefinitions map[string]any `yaml:"cli_definitions,omitempty" json:"cli_definitions,omitempty"`
}

ModelsConfig holds model provider configuration and defaults.

type PermissionsConfig

type PermissionsConfig struct {
	Preset        PermissionsPreset            `yaml:"preset,omitempty"        json:"preset,omitempty"`
	Tools         []string                     `yaml:"tools,omitempty"         json:"tools,omitempty"`
	DisabledTools []string                     `yaml:"disabled_tools,omitempty" json:"disabled_tools,omitempty"`
	Filesystem    *FilesystemPermissionsConfig `yaml:"filesystem,omitempty"    json:"filesystem,omitempty"`
	Exec          *ExecPermissionsConfig       `yaml:"exec,omitempty"          json:"exec,omitempty"`
	// CLIBuiltinTools lets a CLI-backed agent (model "cli/...") use the CLI's
	// own shell, file-edit and web tools. Requires the full preset; otherwise
	// the CLI only gets Aviary's MCP tools.
	CLIBuiltinTools bool `yaml:"cli_builtin_tools,omitempty" json:"cli_builtin_tools,omitempty"`
}

PermissionsConfig restricts which MCP tools an agent may use. When Tools is non-empty it acts as an allow-list: only the named tools are offered to the agent. An empty or absent Permissions block means all tools are available (no restriction).

type PermissionsPreset

type PermissionsPreset string

PermissionsPreset defines the maximum tool surface an agent may use.

const (
	// PermissionsPresetFull allows every available tool group.
	PermissionsPresetFull PermissionsPreset = "full"
	// PermissionsPresetStandard blocks higher-risk local and server tools.
	PermissionsPresetStandard PermissionsPreset = "standard"
	// PermissionsPresetMinimal allows only the smallest safe subset of tools.
	PermissionsPresetMinimal PermissionsPreset = "minimal"
)

func EffectivePermissionsPreset

func EffectivePermissionsPreset(perms *PermissionsConfig) PermissionsPreset

EffectivePermissionsPreset returns the runtime preset, defaulting to standard.

type ProjectConfig added in v0.7.0

type ProjectConfig struct {
	// Target is owner/repo, a repository URL, a project board, or a
	// Discussions board.
	Target string `yaml:"target" json:"target"`
	// Reports sends this project's job lifecycle events through an Aviary
	// agent's channels. Unset means no reports.
	Reports *ProjectReportsConfig `yaml:"reports,omitempty" json:"reports,omitempty"`
}

ProjectConfig is one watched project. The agent whose projects: list holds it owns it: that agent's model and fallbacks, in order, are the provider and model defaults of the project's jobs, a job running on the first one whose quota is not used up.

type ProjectReportsConfig added in v0.7.0

type ProjectReportsConfig struct {
	// Agent is the Aviary agent whose channels deliver the reports.
	Agent string `yaml:"agent" json:"agent"`
	// Targets are where reports go, in the same form as a scheduled task's
	// target: "channel:<channel name>" or "session:<name>".
	Targets []string `yaml:"targets" json:"targets"`
	// Events limits reports to these job events. Empty means every event in
	// ProjectReportEvents.
	Events []string `yaml:"events,omitempty" json:"events,omitempty"`
}

ProjectReportsConfig is a project's opt-in to job reports.

func (*ProjectReportsConfig) Enabled added in v0.7.0

func (r *ProjectReportsConfig) Enabled() bool

Enabled reports whether reports are on: an agent and at least one target are set.

func (*ProjectReportsConfig) Reports added in v0.7.0

func (r *ProjectReportsConfig) Reports(event string) bool

Reports reports whether event is reported.

type ProjectsConfig added in v0.7.0

type ProjectsConfig struct {
	// Concurrency is how many jobs run at once across every project. 0 means
	// DefaultProjectsConcurrency.
	Concurrency int `yaml:"concurrency,omitempty" json:"concurrency,omitempty"`
	// Interval is the time between GitHub polls, as a Go duration. Unset
	// means DefaultProjectsBrowserInterval for browser delivery and
	// DefaultProjectsInterval otherwise.
	Interval string `yaml:"interval,omitempty" json:"interval,omitempty"`
	// Delivery is how GitHub changes arrive: "browser" (the default) reads
	// the rendered pages in Aviary's browser, signed in as the user; "poll"
	// polls through gh; "webhook" takes webhook deliveries.
	Delivery string `yaml:"delivery,omitempty" json:"delivery,omitempty"`
	// BrowserVision turns on browser delivery's capped screenshot fallback
	// for pages it can no longer read.
	BrowserVision bool `yaml:"browser_vision,omitempty" json:"browser_vision,omitempty"`
	// BrowserVisible shows the browser browser delivery reads with, for
	// debugging. It needs a display.
	BrowserVisible bool `yaml:"browser_visible,omitempty" json:"browser_visible,omitempty"`
	// ReadyState is the board status that marks an item ready. Empty
	// auto-detects Todo or Ready.
	ReadyState string `yaml:"ready_state,omitempty" json:"ready_state,omitempty"`
	// Filter is the issue search filter, one entry per term group. Empty
	// means DefaultProjectsFilter.
	Filter []string `yaml:"filter,omitempty" json:"filter,omitempty"`
	// AllIssues drops the issue filter.
	AllIssues bool `yaml:"all_issues,omitempty" json:"all_issues,omitempty"`
	// AllowedCommenters are the GitHub logins whose comments steer jobs.
	// Empty means the authenticated gh user.
	AllowedCommenters []string `yaml:"allowed_commenters,omitempty" json:"allowed_commenters,omitempty"`
	// ApprovalMode is the Code Loop surface's approval-mode override for the
	// CLI runs it launches. Empty follows approval.mode.
	ApprovalMode clidefs.ApprovalMode `yaml:"approval_mode,omitempty" json:"approval_mode,omitempty"`
	// Yolo is the full approval mode, honoured when ApprovalMode is unset.
	Yolo bool `yaml:"yolo,omitempty" json:"yolo,omitempty"`
	// NoMerge asks gh-fix to leave finished pull requests for a human.
	NoMerge bool `yaml:"no_merge,omitempty" json:"no_merge,omitempty"`
	// NoChangelog asks gh-fix to skip changelog entries.
	NoChangelog bool `yaml:"no_changelog,omitempty" json:"no_changelog,omitempty"`
	// Model and Fallbacks override the owning agent's model and fallbacks
	// for every project's jobs: CLI provider models such as claude/opus,
	// tried in order. Empty Model keeps the agent's.
	Model     string   `yaml:"model,omitempty" json:"model,omitempty"`
	Fallbacks []string `yaml:"fallbacks,omitempty" json:"fallbacks,omitempty"`
	// UnblockInterval is how often the stuck-job watchdog runs, as a Go
	// duration; "0" turns it off.
	UnblockInterval string `yaml:"unblock_interval,omitempty" json:"unblock_interval,omitempty"`
	// UnblockAgent and UnblockModel pick the watchdog's agent call. Empty
	// means the coding agent.
	UnblockAgent string `yaml:"unblock_agent,omitempty" json:"unblock_agent,omitempty"`
	UnblockModel string `yaml:"unblock_model,omitempty" json:"unblock_model,omitempty"`
	// ChatModel and ChatFallbacks pick the model of the built-in Code Loop
	// agent behind the board's prompt chat. Empty uses models.defaults, as
	// for any Aviary agent.
	ChatModel     string   `yaml:"chat_model,omitempty" json:"chat_model,omitempty"`
	ChatFallbacks []string `yaml:"chat_fallbacks,omitempty" json:"chat_fallbacks,omitempty"`
	// TempDirs are where job clones go, tried in order. Empty means the
	// system temp directory.
	TempDirs []string `yaml:"temp_dirs,omitempty" json:"temp_dirs,omitempty"`
	// Webhook configures webhook delivery.
	Webhook *ProjectsWebhookConfig `yaml:"webhook,omitempty" json:"webhook,omitempty"`
}

ProjectsConfig is the top-level projects: section in aviary.yaml: the one set of Code Loop settings, shared by every project of every agent. Every field is optional and holds only a value that differs from its default, so a watch started with defaults writes nothing here. The projects themselves are listed under the agents that own them; see AgentProjectsConfig.

func (ProjectsConfig) EffectiveApprovalMode added in v0.7.0

func (p ProjectsConfig) EffectiveApprovalMode(general clidefs.ApprovalMode) clidefs.ApprovalMode

EffectiveApprovalMode resolves the Code Loop surface's approval mode against the general setting: the section's approval_mode wins, then yolo (which is the full mode), then general.

func (ProjectsConfig) EffectiveConcurrency added in v0.7.0

func (p ProjectsConfig) EffectiveConcurrency() int

EffectiveConcurrency returns the job limit.

func (ProjectsConfig) EffectiveDelivery added in v0.7.0

func (p ProjectsConfig) EffectiveDelivery() string

EffectiveDelivery returns "browser", "poll" or "webhook".

func (ProjectsConfig) EffectiveFilter added in v0.7.0

func (p ProjectsConfig) EffectiveFilter() string

EffectiveFilter returns the issue search filter.

func (ProjectsConfig) EffectiveInterval added in v0.7.0

func (p ProjectsConfig) EffectiveInterval() time.Duration

EffectiveInterval returns the poll interval.

func (ProjectsConfig) IsZero added in v0.7.0

func (p ProjectsConfig) IsZero() bool

IsZero reports whether the section holds nothing, so Save leaves it out.

func (ProjectsConfig) Override added in v0.7.0

func (p ProjectsConfig) Override(overlay ProjectsConfig) ProjectsConfig

Override returns p with a runtime watch's non-zero settings laid over it.

type ProjectsWebhookConfig added in v0.7.0

type ProjectsWebhookConfig struct {
	Listen      string `yaml:"listen,omitempty"       json:"listen,omitempty"`
	Path        string `yaml:"path,omitempty"         json:"path,omitempty"`
	Secret      string `yaml:"secret,omitempty"       json:"secret,omitempty"`
	NgrokBinary string `yaml:"ngrok_binary,omitempty" json:"ngrok_binary,omitempty"`
}

ProjectsWebhookConfig configures the webhook listener and its tunnel.

type ProviderConfig

type ProviderConfig struct {
	Auth    string `yaml:"auth,omitempty" json:"auth,omitempty"`
	BaseURI string `yaml:"base_uri,omitempty" json:"base_uri,omitempty"`
}

ProviderConfig holds auth for a model provider.

type SchedulerConfig

type SchedulerConfig struct {
	Concurrency     any   `yaml:"concurrency,omitempty"      json:"concurrency,omitempty"` // "auto" or a number
	PrecomputeTasks *bool `yaml:"precompute_tasks,omitempty" json:"precompute_tasks,omitempty"`
}

SchedulerConfig holds scheduler settings.

type SearchConfig

type SearchConfig struct {
	Web WebSearchConfig `yaml:"web,omitempty" json:"web,omitempty"`
}

SearchConfig holds search backend settings.

type ServerConfig

type ServerConfig struct {
	Port           int        `yaml:"port,omitempty"            json:"port,omitempty"`
	TLS            *TLSConfig `yaml:"tls,omitempty"             json:"tls,omitempty"`
	ExternalAccess bool       `yaml:"external_access,omitempty" json:"external_access,omitempty"` // bind to 0.0.0.0 instead of 127.0.0.1
	NoTLS          bool       `yaml:"no_tls,omitempty"          json:"no_tls,omitempty"`          // disable TLS (plain HTTP)
	// DisableTokenAuth turns off bearer-token checks on the HTTP, WebSocket,
	// and MCP endpoints, so anyone who can reach the server can use it.
	DisableTokenAuth bool `yaml:"disable_token_auth,omitempty" json:"disable_token_auth,omitempty"`
	// FailedTaskTimeout is the maximum age of a pending run checkpoint before
	// the agent gives up and notifies the session instead of resuming.
	// Accepts Go duration strings like "6h", "30m". Defaults to 6h if unset.
	FailedTaskTimeout string `yaml:"failed_task_timeout,omitempty" json:"failed_task_timeout,omitempty"`
	// AutoUpdate installs new releases automatically as soon as they are
	// available, checkpointing running jobs so they resume after the restart.
	// Unset means on; see EffectiveServerAutoUpdate.
	AutoUpdate *bool `yaml:"auto_update,omitempty" json:"auto_update,omitempty"`
	// RestartCallGrace is how long a pending automatic restart keeps admitting
	// new MCP tool calls while it waits for in-flight ones. Go duration
	// string; defaults to 1m.
	RestartCallGrace string `yaml:"restart_call_grace,omitempty" json:"restart_call_grace,omitempty"`
	// RestartCallMaxWait is how long a restart waits for in-flight MCP tool
	// calls before it proceeds anyway. Go duration string; defaults to 5m.
	RestartCallMaxWait string `yaml:"restart_call_max_wait,omitempty" json:"restart_call_max_wait,omitempty"`
}

ServerConfig holds HTTP server settings.

func (ServerConfig) EffectiveFailedTaskTimeout

func (s ServerConfig) EffectiveFailedTaskTimeout() time.Duration

EffectiveFailedTaskTimeout returns the parsed duration for FailedTaskTimeout, falling back to DefaultFailedTaskTimeout if unset or invalid.

func (ServerConfig) EffectiveRestartCallGrace added in v0.7.1

func (s ServerConfig) EffectiveRestartCallGrace() time.Duration

EffectiveRestartCallGrace returns the parsed RestartCallGrace, or 0 (the restart gate's default) when unset or invalid.

func (ServerConfig) EffectiveRestartCallMaxWait added in v0.7.1

func (s ServerConfig) EffectiveRestartCallMaxWait() time.Duration

EffectiveRestartCallMaxWait returns the parsed RestartCallMaxWait, or 0 (the restart gate's default) when unset or invalid.

type SkillConfig

type SkillConfig struct {
	Enabled  bool           `yaml:"enabled,omitempty"  json:"enabled,omitempty"`
	Settings map[string]any `yaml:"settings,omitempty" json:"settings,omitempty"`
}

SkillConfig configures an installed skill runtime.

type TLSConfig

type TLSConfig struct {
	Cert string `yaml:"cert,omitempty" json:"cert,omitempty"`
	Key  string `yaml:"key,omitempty"  json:"key,omitempty"`
	// SANs lists extra hostnames and IP addresses the generated self-signed
	// cert covers, on top of localhost, the hostname, and the LAN addresses.
	SANs []string `yaml:"sans,omitempty" json:"sans,omitempty"`
	// NoHostSANs leaves the hostname and LAN addresses out of the generated
	// cert, for hosts such as containers whose own names clients never use.
	NoHostSANs bool `yaml:"no_host_sans,omitempty" json:"no_host_sans,omitempty"`
}

TLSConfig holds paths to TLS certificate and key.

func EffectiveServerTLS added in v0.7.3

func EffectiveServerTLS(s ServerConfig) TLSConfig

EffectiveServerTLS returns the server's TLS settings. AVIARY_CONFIG_SERVER_TLS_CERT and AVIARY_CONFIG_SERVER_TLS_KEY override server.tls.cert and server.tls.key, and AVIARY_CONFIG_SERVER_TLS_SANS, a comma-separated list, overrides server.tls.sans. AVIARY_CONFIG_SERVER_TLS_NO_HOST_SANS overrides server.tls.no_host_sans.

type TaskConfig

type TaskConfig struct {
	Enabled  *bool  `yaml:"enabled,omitempty"  json:"enabled,omitempty"`
	Name     string `yaml:"name"               json:"name"`
	Type     string `yaml:"type,omitempty"     json:"type,omitempty"`
	Schedule string `yaml:"schedule,omitempty" json:"schedule,omitempty"`
	StartAt  string `yaml:"start_at,omitempty" json:"start_at,omitempty"`
	RunOnce  bool   `yaml:"run_once,omitempty" json:"run_once,omitempty"`
	// Trigger selects how a scheduled task fires: once, interval, daily,
	// weekly or cron. When empty it is inferred from the other fields.
	Trigger string `yaml:"trigger,omitempty"  json:"trigger,omitempty"`
	// Every is the interval trigger's period, e.g. "30m" or "2h".
	Every string `yaml:"every,omitempty"    json:"every,omitempty"`
	// At is the daily or weekly trigger's time of day ("HH:MM"); several
	// comma-separated times fire on the same day.
	At string `yaml:"at,omitempty"       json:"at,omitempty"`
	// Days lists the weekly trigger's weekdays, comma-separated ("mon,wed").
	Days string `yaml:"days,omitempty"     json:"days,omitempty"`
	// Channel, Entry and Match configure a workflow: a task whose trigger is
	// "message". Channel names the agent's channel (its name or ID), Entry
	// the conversation on it the workflow watches (a Slack channel ID, a
	// Signal phone number or group ID; empty watches every conversation),
	// and Match a case-insensitive wildcard pattern the message text must
	// match (empty matches every message).
	Channel string `yaml:"channel,omitempty"  json:"channel,omitempty"`
	Entry   string `yaml:"entry,omitempty"    json:"entry,omitempty"`
	Match   string `yaml:"match,omitempty"    json:"match,omitempty"`
	// Timezone is the IANA zone triggers are evaluated in (default: local).
	Timezone string `yaml:"timezone,omitempty" json:"timezone,omitempty"`
	// Overlap decides what a fire does while a previous run is still
	// pending or running: "queue" (default) or "skip".
	Overlap string `yaml:"overlap,omitempty"  json:"overlap,omitempty"`
	// Missed decides what happens to fires missed while Aviary was stopped
	// or the machine slept: "skip" (default) or "run_once".
	Missed string `yaml:"missed,omitempty"   json:"missed,omitempty"`
	Watch  string `yaml:"watch,omitempty"    json:"watch,omitempty"`
	Prompt string `yaml:"prompt,omitempty"   json:"prompt,omitempty"`
	Target string `yaml:"target,omitempty"   json:"target,omitempty"`
	// Project is the watched Code Loop target a "project" task runs its prompt
	// against as a board job.
	Project string `yaml:"project,omitempty"  json:"project,omitempty"`
	// Model overrides the project agent's default model for a project task's
	// runs; empty runs them with the agent's own model.
	Model string `yaml:"model,omitempty"    json:"model,omitempty"`
	// Precompile asks for a prompt or project task's prompt to be compiled
	// into a script that runs without the model, falling back to the model
	// when the script fails; the task keeps its prompt. See
	// PrecompilesBesidePrompt for which tasks support it.
	Precompile *bool `yaml:"precompile,omitempty" json:"precompile,omitempty"`
	// Compiled is the task's compiled Lua script, empty when its
	// prompt did not pass the determinism gate, and CompiledKey identifies
	// the prompt, project and tool set it was compiled from, so a change to
	// any of them recompiles it.
	Compiled    string `yaml:"compiled,omitempty"     json:"compiled,omitempty"`
	CompiledKey string `yaml:"compiled_key,omitempty" json:"compiled_key,omitempty"`
	// ScriptVerified is set once the compiled script has completed a run,
	// and ScriptFailures counts its consecutive failed runs since. Both are
	// reset whenever the script is recompiled.
	ScriptVerified bool `yaml:"script_verified,omitempty" json:"script_verified,omitempty"`
	ScriptFailures int  `yaml:"script_failures,omitempty" json:"script_failures,omitempty"`
	// PrecompileNote says why Aviary set the compiled script aside: it failed
	// its first run, or it failed too many runs in a row and precompile was
	// turned off. It is cleared when the script is recompiled or precompile
	// is turned back on.
	PrecompileNote string `yaml:"precompile_note,omitempty" json:"precompile_note,omitempty"`
	// IdleTimeout is how long a prompt run may go without any output before
	// it is stopped and marked failed, e.g. "30m". "0" disables it. Empty
	// uses DefaultTaskIdleTimeout.
	IdleTimeout string `yaml:"idle_timeout,omitempty" json:"idle_timeout,omitempty"`
	// FromFile is set when the task was loaded from a markdown file rather than
	// defined inline in aviary.yaml. It is intentionally excluded from YAML
	// serialization so it never gets written back to the config file.
	FromFile bool `yaml:"-" json:"from_file,omitempty"`
}

TaskConfig describes a scheduled or file-watch task.

func LoadAgentTaskFiles

func LoadAgentTaskFiles(agentCfg AgentConfig) ([]TaskConfig, error)

LoadAgentTaskFiles globs <AgentTasksDir>/*.md and returns the parsed task configs. Files whose base name starts with "_" are treated as placeholders and skipped. A missing tasks directory is silently ignored.

func LoadMarkdownTask

func LoadMarkdownTask(filename string) (TaskConfig, error)

LoadMarkdownTask reads a task markdown file and parses it. The default task name is derived from the filename stem (everything before the final ".md").

func ParseMarkdownTask

func ParseMarkdownTask(defaultName string, data []byte) (TaskConfig, error)

ParseMarkdownTask parses a task definition from markdown content with optional YAML frontmatter. defaultName is used when the frontmatter does not set a name. The markdown body (the text below the closing "---") is used as the task prompt.

func (TaskConfig) EffectiveIdleTimeout added in v0.7.2

func (t TaskConfig) EffectiveIdleTimeout() time.Duration

EffectiveIdleTimeout returns the parsed IdleTimeout: zero when disabled, DefaultTaskIdleTimeout when unset or invalid.

func (TaskConfig) IsWorkflow added in v0.7.8

func (t TaskConfig) IsWorkflow() bool

IsWorkflow reports whether t is a workflow, triggered by channel messages instead of a schedule or file watch.

func (TaskConfig) PrecompilesBesidePrompt added in v0.7.14

func (t TaskConfig) PrecompilesBesidePrompt() bool

PrecompilesBesidePrompt reports whether t can be precompiled: whether its prompt can be compiled into a script stored beside it, in Compiled, which runs in place of the model and falls back to it when the script fails. Prompt tasks, scheduled or workflows, and project tasks can; a script task already runs its own Lua script, so it has no prompt to compile. It is the one rule the validator, the scheduler and compiler, the task tools and the editors share.

func (*TaskConfig) UnmarshalYAML added in v0.7.0

func (t *TaskConfig) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML reads a task, accepting the old "run_agent" and "cli" keys (see LegacyTaskModel) for Model. Saving the task writes it back as model.

type TaskTarget added in v0.7.8

type TaskTarget struct {
	Kind string
	// Session is the session name or ID of a session target, and Channel the
	// channel name of a channel target.
	Session string
	Channel string
	// Project and Number name the job of a Code Loop target, and Resume and
	// Reopen are its CodeLoopResume and CodeLoopReopen options.
	Project string
	Number  int
	Resume  bool
	Reopen  bool
}

TaskTarget is a parsed task or workflow delivery target. ParseTaskTarget is the one resolver tasks, workflows, validation and delivery all use.

func ParseTaskTarget added in v0.7.8

func ParseTaskTarget(target string) (TaskTarget, error)

ParseTaskTarget resolves a delivery target: empty or "silent", "reply", "session:<name-or-id>", "channel:<channel name>", or "codeloop:<project>#<number>[?resume,reopen]".

func (TaskTarget) String added in v0.7.8

func (t TaskTarget) String() string

String writes the target back in its saved form.

type TranscriptionConfig added in v0.7.3

type TranscriptionConfig struct {
	// Enabled turns transcription on; it defaults to true when unset. When
	// off, voice messages reach the agent as plain file attachments.
	Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	// Engine is the transcription engine; only "local" (whisper.cpp) is
	// supported, and it is the default.
	Engine string `yaml:"engine,omitempty" json:"engine,omitempty"`
	// Model is a whisper.cpp model name such as "base.en", or a path to a
	// ggml model file. Defaults to "base.en".
	Model string `yaml:"model,omitempty" json:"model,omitempty"`
	// Language is "auto" or an ISO 639-1 code such as "en". Defaults to "auto".
	Language string `yaml:"language,omitempty" json:"language,omitempty"`
}

TranscriptionConfig configures speech-to-text for voice messages.

type Watcher

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

Watcher watches aviary.yaml for changes and calls registered handlers.

func NewWatcher

func NewWatcher(path string) *Watcher

NewWatcher creates a Watcher for path. If path is empty, DefaultPath() is used.

func (*Watcher) OnChange

func (w *Watcher) OnChange(fn func(*Config))

OnChange registers a handler that is called whenever the config reloads successfully.

func (*Watcher) Start

func (w *Watcher) Start() error

Start begins watching the config file. It blocks until Stop is called.

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop signals the watcher to shut down.

type WebSearchConfig

type WebSearchConfig struct {
	BraveAPIKey string `yaml:"brave_api_key,omitempty" json:"brave_api_key,omitempty"`
}

WebSearchConfig holds web search provider credentials.

Jump to

Keyboard shortcuts

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