Documentation
¶
Overview ¶
Package config loads the user's settings and locates the state directory.
Index ¶
- Constants
- func DaemonSocket() string
- func Dir() string
- func ExpandHome(p string) string
- func Home() string
- func KeyOf(field string) string
- func Path() string
- func ProfilesDir() string
- func ResolveProfile(v string) string
- func StateDir() string
- type ApprovalConfig
- type ApprovalRuleConfig
- type Brief
- type Classify
- type Cleanup
- type Config
- func (c Config) AgentHomes() []string
- func (c Config) Column(sink, status string) string
- func (c Config) DraftApprovalWarnings() []string
- func (c Config) For(owner, repo string) Config
- func (c Config) PlacementMap() placement.Map
- func (c Config) PluginDraftApproval(id string) draft.Approval
- func (c Config) PluginEnabled(id string) bool
- func (c Config) PluginSwitches() []string
- func (c Config) ProjectSettingsFor(intent string, pr expr.Facts) bool
- func (c Config) WithColumns(defaults map[string]map[string]string) Config
- type Days
- type Dossiers
- type Drafts
- type GTD
- type GitHub
- type HTTP
- type Headless
- type Holder
- type HolderOptions
- type IntentConfig
- type Items
- type ItemsHeat
- type MCP
- type Notifications
- type Nudge
- type PlacementRule
- type Plugin
- type PluginApproval
- type PluginDrafts
- type Project
- type ProjectGitHub
- type ProjectSettings
- type Scope
- type SinkConfig
- type Slack
- type SlackExtraction
- func (e SlackExtraction) ContextBudget() int
- func (e SlackExtraction) ContextN() int
- func (e SlackExtraction) EscalateOver() int
- func (e SlackExtraction) GiveUpAfter() int
- func (e SlackExtraction) LanguageName() string
- func (e SlackExtraction) MaxCallUSD() float64
- func (e SlackExtraction) MaxDayCalls() int
- func (e SlackExtraction) MaxDayUSD() float64
- func (e SlackExtraction) MaxWaitFor() time.Duration
- func (e SlackExtraction) On() bool
- func (e SlackExtraction) QuietFor() time.Duration
- func (e SlackExtraction) TierName() string
- func (e SlackExtraction) Window() int
- type SlackIngest
- type SlackTurns
- type Stalled
- type Sweep
- type Turns
- type UnknownKeysError
- type WorkflowConfig
- type WorkflowDrafts
Constants ¶
const ( ColumnWorking = "working" ColumnWorkingFallback = "working-fallback" ColumnNeedsMe = "needs-me" ColumnReviewed = "reviewed" ColumnReady = "ready" ColumnInProgress = "in-progress" ColumnInReview = "in-review" ColumnCompleted = "completed" )
const DefaultMCPPort = 47800
const DefaultPRDailyCap = 5
const DefaultSlackRedirectPort = 53682
DefaultSlackRedirectPort is the login callback port registered in the Slack app.
const MinSlackTurnChars = 2000
MinSlackTurnChars is the smallest cap Chars returns, which holds a parent and a reply.
const StatEvery = 2 * time.Second
StatEvery is how often a Holder looks at the config file.
const UserHomeVar = "LOOP_USER_HOME"
UserHomeVar names an absolute directory Home returns instead of the user's, so an isolated daemon finds no agent home of the user while HOME, which the Keychain needs, stays real.
Variables ¶
This section is empty.
Functions ¶
func DaemonSocket ¶
func DaemonSocket() string
func ExpandHome ¶
func KeyOf ¶ added in v0.2.0
KeyOf is the file's key of Config's top-level field, such as the namespace a plugin's settings live under.
func ProfilesDir ¶
func ProfilesDir() string
ProfilesDir holds the review profiles named by a bare name.
func ResolveProfile ¶
ResolveProfile turns a profile setting into a directory: a bare name lives under ProfilesDir, anything else is a path.
Types ¶
type ApprovalConfig ¶
type ApprovalConfig struct {
Mode string `json:"mode,omitempty"`
Window *Days `json:"window,omitempty"`
Rule []ApprovalRuleConfig `json:"rule,omitempty"`
}
ApprovalConfig overlays an approval block field by field: Mode and Window replace the manifest's, Rule its rules; "", nil and a nil Rule keep the manifest's, an empty Rule clears them.
type ApprovalRuleConfig ¶ added in v0.2.0
type Brief ¶
type Brief struct {
Enabled bool `json:"enabled"`
Tier turns.Tier `json:"tier"`
MaxInputBytes int `json:"max_input_bytes"`
}
Brief previews each pull request with one headless call of the agent, outside the sweeps.
type Cleanup ¶
type Cleanup struct {
Idle Days `json:"idle"`
AskedIdle Days `json:"asked_idle"`
WorkspaceGrace Days `json:"workspace_grace"` // counted in working time
ManualIdle Days `json:"manual_idle"`
StaleWorkspace Days `json:"stale_workspace"`
// Disposable names ignored files and directories a tool recreates, so
// removing a workspace that holds them loses nothing.
Disposable []string `json:"disposable"`
}
Cleanup holds the thresholds of the session and workspace cleanup workflows.
type Config ¶
type Config struct {
// ProjectsDir is where `review` clones a repository that is not
// registered in the workspace manager yet. No default: a wrong guess
// clones duplicates.
ProjectsDir string `json:"projects_dir"`
// WorkspaceManagers are the enabled workspace managers in the order a new
// worktree picks them: the first that hosts the agent and honors the
// session's launch policy owns it.
WorkspaceManagers []string `json:"workspace_managers"`
Agent string `json:"agent"`
// GitHub is the GitHub plugin's settings.
GitHub GitHub `json:"github"`
// AgentHome is the agent's own configuration directory (CLAUDE_CONFIG_DIR
// for Claude Code), "" for the agent's default.
AgentHome string `json:"agent_home"`
// Profile is the directory with the reviewer's judgment.
Profile string `json:"profile"`
// AgentModels pins, per agent, a model tier to one of that agent's
// own model names; the loop hands the name to the agent unread.
AgentModels map[string]map[turns.Tier]string `json:"agent_models"`
// Projects override settings for the pull requests of matching
// repositories; the first match wins.
Projects []Project `json:"projects"`
Sweep Sweep `json:"sweep"`
HTTP HTTP `json:"http"`
MCP MCP `json:"mcp"`
Brief Brief `json:"brief"`
// Views holds each view sink's own settings by sink name.
Views map[string]SinkConfig `json:"views"`
Cleanup Cleanup `json:"cleanup"`
Classify Classify `json:"classify"`
// Workflows override each workflow's manifest by workflow name.
Workflows map[string]WorkflowConfig `json:"workflows"`
// Intents set each intent's settings by intent name.
Intents map[string]IntentConfig `json:"intents"`
// Plugins switch, by provider id, a plugin registered without a settings
// namespace, which has no <id>.enabled for the file to set: the
// composition root that registers it switches it here, as a test's
// plugin is. Every plugin the file knows switches with <id>.enabled.
Plugins map[string]Plugin `json:"-"`
// Placement is the rules that place units; the first match wins.
Placement []PlacementRule `json:"placement,omitempty"`
GTD GTD `json:"gtd"`
// Notifications sets the menu bar's daily digest.
Notifications Notifications `json:"notifications"`
Slack Slack `json:"slack"`
Dossiers Dossiers `json:"dossiers"`
Drafts Drafts `json:"drafts"`
Items Items `json:"items"`
Headless Headless `json:"headless"`
Turns Turns `json:"turns"`
}
func Defaults ¶
func Defaults() Config
Defaults is the config without a file. It names no agent and no workspace manager: the composition root picks those.
func (Config) AgentHomes ¶
AgentHomes lists every agent home the settings name.
func (Config) DraftApprovalWarnings ¶ added in v0.2.0
DraftApprovalWarnings name each rule of a workflows.<name>.drafts.approval that releases, reads draft.delivery and never releases a comment draft.
func (Config) PlacementMap ¶
PlacementMap is c's placement rules as the placement service reads them.
func (Config) PluginDraftApproval ¶ added in v0.2.0
PluginDraftApproval is the approval of the drafts plugin id's own rules propose: its <id>.drafts.approval, wait when the config sets none.
func (Config) PluginEnabled ¶
PluginEnabled says whether the plugin id is on: its <id>.enabled when the file has a namespace for it, else its entry in Plugins; a nil switch is on.
func (Config) PluginSwitches ¶ added in v0.2.0
PluginSwitches are the ids of every plugin the config can switch.
func (Config) ProjectSettingsFor ¶
ProjectSettingsFor says whether a session of intent on the pull request whose facts pr resolves loads the checkout's own agent settings. Without the facts, an intent that has a predicate does not.
type Days ¶
Days is a duration written as duration.Parse reads it: "2d", "36h", "90m".
func (Days) MarshalJSON ¶
func (*Days) UnmarshalJSON ¶
type Dossiers ¶
type Dossiers struct {
ArchiveAfter Days `json:"archive_after"` // after the unit or project resolved
PurgeAfter Days `json:"purge_after"` // after the archive
SoftCapMB int64 `json:"soft_cap_mb"` // per dossier, reported by doctor
TotalCapMB int64 `json:"total_cap_mb"` // dossiers and archives, reported by doctor
MaxFileMB int64 `json:"max_file_mb"` // a larger file is refused, linked instead
CompactAtKB int64 `json:"compact_at_kb"` // log/ size that triggers compaction
}
Dossiers sets the dossiers' lifecycle and quotas; a value of zero or less keeps its default.
type Drafts ¶ added in v0.2.0
type Drafts struct {
// RepeatAfter is how long a nudged, discarded, sent or observed draft
// keeps its rule or workflow from proposing it again, by default.
RepeatAfter Days `json:"repeat_after"`
}
Drafts holds the settings every proposer's drafts share.
type GTD ¶
type GTD struct {
StaleWaitingDays int `json:"stale_waiting_days"` // working days
Areas []string `json:"areas"`
Contexts []string `json:"contexts"`
}
GTD holds the entries' settings: when a waiting entry goes stale, and the areas and contexts offered.
type GitHub ¶ added in v0.2.0
type GitHub struct {
// Enabled switches the plugin; nil means enabled.
Enabled *bool `json:"enabled,omitempty"`
ReviewPrefix string `json:"review_prefix"`
AutomatedReviewers []string `json:"automated_reviewers"`
// Owners restricts automated follow-ups to these GitHub owners. Empty
// means the owners of every repository the workspace manager knows.
Owners []string `json:"owners"`
// TrustedAuthors are logins whose pull requests pass the author
// association check of automated rounds, such as a bot with no
// association to the repository.
TrustedAuthors []string `json:"trusted_authors"`
// FollowupsWithoutWorkspace lets a follow-up review recreate the review
// workspace the user deleted; off, the sweep only logs the follow-up.
FollowupsWithoutWorkspace bool `json:"followups_without_workspace"`
// AddressWithoutWorkspace lets a triage round on a pull request I
// develop create its author workspace when it has none; off, the sweep
// only records the round it would start.
AddressWithoutWorkspace bool `json:"address_without_workspace"`
// AddressReviews starts a triage round in the author workspace when
// someone reviews a pull request I develop.
AddressReviews bool `json:"address_reviews"`
// AddressSkipReviewers lists logins whose reviews never start a triage
// round.
AddressSkipReviewers []string `json:"address_skip_reviewers"`
// AddressChecks starts a triage round when checks fail on the head of a
// pull request I develop; IgnoreChecks names checks that never do.
AddressChecks bool `json:"address_checks"`
IgnoreChecks []string `json:"ignore_checks"`
// AddressConflicts starts a triage round when a pull request I develop
// conflicts with its base past the conflict window.
AddressConflicts bool `json:"address_conflicts"`
Scope Scope `json:"scope"`
Stalled Stalled `json:"stalled"`
Drafts PluginDrafts `json:"drafts"`
Nudge Nudge `json:"nudge"`
// RateLimitFraction is the share of the GitHub rate limit the sweeps
// may spend.
RateLimitFraction float64 `json:"rate_limit_fraction"`
}
GitHub is the GitHub plugin's settings.
type Headless ¶
type Headless struct {
Tier turns.Tier `json:"tier"`
PerCallUSD float64 `json:"per_call_usd"`
PerDayUSD float64 `json:"per_day_usd"`
}
Headless caps the headless turns: the model tier of their calls, what one call may cost and what they may cost in a day; a cost of zero leaves it uncapped.
type Holder ¶
type Holder struct {
// contains filtered or unexported fields
}
Holder is the one configuration a serve holds. Config is the config the serve started with, except that the profile setting follows the file; every other change makes Stale true until the serve restarts.
func NewHolder ¶
func NewHolder(cfg Config, opts HolderOptions) *Holder
NewHolder holds cfg, the config just loaded from opts.Path.
func (*Holder) Break ¶
Break records that no config has loaded yet, so Err answers err until Rebase.
type HolderOptions ¶
type HolderOptions struct {
// Path is the config file to watch; "" watches nothing.
Path string
// Load reads the config; nil disables reloads.
Load func() (Config, error)
// Stat is os.Stat when nil.
Stat func(string) (os.FileInfo, error)
// Every is the stat interval; StatEvery when zero.
Every time.Duration
// Now is the clock; time.Now when nil.
Now func() time.Time
// OnProfileChange runs, outside the lock, after the profile setting changed to profile.
OnProfileChange func(profile string)
// OnWarningChange runs, outside the lock, after a reload changed what Warning answers.
OnWarningChange func()
}
HolderOptions are the collaborators of a Holder.
type IntentConfig ¶ added in v0.2.0
type IntentConfig struct {
ProjectSettings *ProjectSettings `json:"project_settings,omitempty"`
}
IntentConfig is one intent's settings.
type Items ¶
type Items struct {
Heat ItemsHeat `json:"heat"`
}
Items holds the items ledger's settings.
type ItemsHeat ¶
type ItemsHeat struct {
// WarmFor is how long a unit stays warm after its last item resolved; zero is the heat reader's default.
WarmFor Days `json:"warm_for,omitempty"`
}
type MCP ¶
type MCP struct {
Port int `json:"port"`
}
MCP is the daemon's MCP endpoint, which agent homes register by URL.
type Notifications ¶
type Notifications struct {
DigestAt string `json:"digest_at"`
}
Notifications: DigestAt is the local "HH:MM" of the daily digest, "" for none.
type PlacementRule ¶
type PlacementRule struct {
Match string `json:"match"`
Repo string `json:"repo,omitempty"`
Checkout string `json:"checkout,omitempty"`
Role string `json:"role,omitempty"`
}
PlacementRule is one rule of the placement map.
type Plugin ¶
type Plugin struct {
Enabled *bool `json:"enabled,omitempty"`
}
Plugin is one plugin's switch; a nil Enabled means enabled.
type PluginApproval ¶ added in v0.2.0
func (PluginApproval) Approval ¶ added in v0.2.0
func (a PluginApproval) Approval() draft.Approval
Approval is a as a draft's approval.
type PluginDrafts ¶ added in v0.2.0
type PluginDrafts struct {
Approval *PluginApproval `json:"approval,omitempty"`
}
PluginDrafts holds the approval of the drafts a plugin's own rules propose.
type Project ¶
type Project struct {
Match string `json:"match"`
ProjectsDir string `json:"projects_dir"`
// Agent is the agent the project's sessions run.
Agent string `json:"agent"`
AgentHome string `json:"agent_home"`
// WorkspaceManagers orders the managers a new worktree of the project picks from.
WorkspaceManagers []string `json:"workspace_managers"`
GitHub ProjectGitHub `json:"github"`
}
Project matches repositories by an owner/repo pattern such as "acme/*" or "acme/infra". Empty fields keep the top-level value.
type ProjectGitHub ¶ added in v0.2.0
type ProjectGitHub struct {
TrustedAuthors []string `json:"trusted_authors"`
FollowupsWithoutWorkspace *bool `json:"followups_without_workspace"`
AddressWithoutWorkspace *bool `json:"address_without_workspace"`
}
ProjectGitHub are the GitHub settings a project overrides; nil keeps the top-level value.
type ProjectSettings ¶ added in v0.2.0
type ProjectSettings struct {
When string `json:"when"`
}
ProjectSettings says where an intent's sessions load the checkout's own agent settings: When is a predicate over its pull request's facts; where it does not hold, they start without them.
type SinkConfig ¶
type SinkConfig struct {
// Columns maps a semantic status (working, working-fallback, needs-me, reviewed, ready, in-progress, in-review, completed) to the sink's column.
Columns map[string]string `json:"columns"`
}
SinkConfig is one view sink's own settings.
type Slack ¶
type Slack struct {
// Enabled switches the plugin; nil means enabled.
Enabled *bool `json:"enabled,omitempty"`
// ClientID is the Slack app's client id; empty leaves Slack unconfigured.
ClientID string `json:"client_id"`
RedirectPort int `json:"redirect_port"`
// KeychainService names the Keychain items; empty is brand.StateDir()+"-slack".
KeychainService string `json:"keychain_service"`
// PostAllowlist, when not empty, holds the only channel ids, or user ids naming
// the DM with that user, a post may go to.
PostAllowlist []string `json:"post_allowlist"`
// RequestLog logs one line per Slack call: method and HTTP status.
RequestLog bool `json:"request_log"`
Ingest SlackIngest `json:"ingest"`
Extraction SlackExtraction `json:"extraction"`
Turns SlackTurns `json:"turns"`
Drafts PluginDrafts `json:"drafts"`
}
Slack holds the Slack source's settings; no secret lives here.
func (Slack) Configured ¶
type SlackExtraction ¶
type SlackExtraction struct {
// Enabled nil is on.
Enabled *bool `json:"enabled,omitempty"`
// Tier is fast, balanced or frontier; empty is fast.
Tier string `json:"tier,omitempty"`
Language string `json:"language,omitempty"`
PerCallUSD float64 `json:"per_call_usd,omitempty"`
PerDayUSD float64 `json:"per_day_usd,omitempty"`
PerDay int `json:"per_day,omitempty"`
// Quiet is how long a unit stays unchanged before it runs; MaxWait bounds the delay of its oldest change.
Quiet Days `json:"quiet,omitempty"`
MaxWait Days `json:"max_wait,omitempty"`
WindowChars int `json:"window_chars,omitempty"`
// MaxFailures failed calls in a row make the job give up on a unit until its next change.
MaxFailures int `json:"max_failures,omitempty"`
// ContextMessages and ContextChars bound the read-only messages shown before a DM's window; -1 turns either off.
ContextMessages int `json:"context_messages,omitempty"`
ContextChars int `json:"context_chars,omitempty"`
// EscalateOverChars sends a unit whose rendered conversation is longer to the frontier tier; 0 or -1 is off.
EscalateOverChars int `json:"escalate_over_chars,omitempty"`
}
SlackExtraction sets the extraction job; a zero value keeps its default.
func (SlackExtraction) ContextBudget ¶
func (e SlackExtraction) ContextBudget() int
func (SlackExtraction) ContextN ¶
func (e SlackExtraction) ContextN() int
func (SlackExtraction) EscalateOver ¶
func (e SlackExtraction) EscalateOver() int
func (SlackExtraction) GiveUpAfter ¶
func (e SlackExtraction) GiveUpAfter() int
func (SlackExtraction) LanguageName ¶
func (e SlackExtraction) LanguageName() string
func (SlackExtraction) MaxCallUSD ¶
func (e SlackExtraction) MaxCallUSD() float64
func (SlackExtraction) MaxDayCalls ¶
func (e SlackExtraction) MaxDayCalls() int
func (SlackExtraction) MaxDayUSD ¶
func (e SlackExtraction) MaxDayUSD() float64
func (SlackExtraction) MaxWaitFor ¶
func (e SlackExtraction) MaxWaitFor() time.Duration
func (SlackExtraction) On ¶
func (e SlackExtraction) On() bool
func (SlackExtraction) QuietFor ¶
func (e SlackExtraction) QuietFor() time.Duration
func (SlackExtraction) TierName ¶
func (e SlackExtraction) TierName() string
func (SlackExtraction) Window ¶
func (e SlackExtraction) Window() int
type SlackIngest ¶
type SlackIngest struct {
// Terms admit a message that holds one of them as a word, in any case.
Terms []string `json:"terms"`
// AllowApps and DenyApps hold bot ids (B...) or app ids (A...).
AllowApps []string `json:"allow_apps"`
DenyApps []string `json:"deny_apps"`
// Socket nil is on.
Socket *bool `json:"socket"`
// Since is the first start's backfill date, YYYY-MM-DD; empty is 7 days back.
Since string `json:"since"`
}
SlackIngest is what the Slack source admits and how it listens.
func (SlackIngest) SocketOn ¶
func (i SlackIngest) SocketOn() bool
type SlackTurns ¶
type SlackTurns struct {
// MaxChars bounds the unit's messages rendered into the instructions; zero is 30000, and less than MinSlackTurnChars reads as it.
MaxChars int `json:"max_chars,omitempty"`
}
SlackTurns sets what a turn on a Slack unit reads.
func (SlackTurns) Chars ¶
func (t SlackTurns) Chars() int
type Turns ¶ added in v0.2.0
Turns caps the automated turns. PerUnitPerDay stops a runaway loop on one unit whose plugin keeps a per-unit count (GitHub's pull requests), counted per local day; PerDay caps the automated turns on every other unit, all workflows together.
type UnknownKeysError ¶
type UnknownKeysError struct {
File string
Keys []string // paths such as "sweep.fsat" or "projects[0].agent_hom"
// Near are the grammar's guesses, by key: "sweep.fsat" did you mean "fast".
Near map[string]string
}
UnknownKeysError names the keys of a config file that no setting reads.
func (*UnknownKeysError) Error ¶
func (e *UnknownKeysError) Error() string
type WorkflowConfig ¶
type WorkflowConfig struct {
Enabled *bool `json:"enabled,omitempty"`
// Observe plans the workflow's items pending, for a person to run.
Observe *bool `json:"observe,omitempty"`
Approval *ApprovalConfig `json:"approval,omitempty"`
// OnlyWhen is a predicate over the workflow's facts that must hold
// besides its manifest's when; "" adds none.
OnlyWhen string `json:"only_when,omitempty"`
Drafts *WorkflowDrafts `json:"drafts,omitempty"`
}
WorkflowConfig overlays a workflow's manifest; a field left out keeps the manifest's.
func (WorkflowConfig) DraftApproval ¶ added in v0.2.0
func (w WorkflowConfig) DraftApproval() *ApprovalConfig
DraftApproval is the workflow's drafts.approval, nil when unset.
type WorkflowDrafts ¶ added in v0.2.0
type WorkflowDrafts struct {
Approval *ApprovalConfig `json:"approval,omitempty"`
}
WorkflowDrafts holds the approval of the drafts a workflow proposes.