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 ParseDays(s string) (time.Duration, error)
- func Path() string
- func ProfilesDir() string
- func ResolveProfile(v string) string
- func StateDir() string
- type ApprovalConfig
- type Brief
- type Classify
- type Cleanup
- type Config
- func (c Config) AgentHomes() []string
- func (c Config) Column(sink, status string) string
- func (c Config) For(owner, repo string) Config
- func (c Config) PlacementMap() placement.Map
- func (c Config) PluginEnabled(id string) bool
- 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 GTD
- type HTTP
- type Headless
- type Holder
- type HolderOptions
- type Items
- type ItemsHeat
- type MCP
- type Notifications
- type Nudge
- type PlacementRule
- type Plugin
- type Project
- type ProposalApproval
- type ProposalRule
- type Proposals
- type Rounds
- 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 UnknownKeysError
- type WorkflowConfig
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 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 Brief ¶
type Brief struct {
Enabled bool `json:"enabled"`
Tier turns.Tier `json:"tier"`
MaxDiffBytes int `json:"max_diff_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"`
ReviewPrefix string `json:"review_prefix"`
Rounds Rounds `json:"rounds"`
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"`
// 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"`
// 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"`
// Projects override settings for the pull requests of matching
// repositories; the first match wins.
Projects []Project `json:"projects"`
Scope Scope `json:"scope"`
Stalled Stalled `json:"stalled"`
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"`
Nudge Nudge `json:"nudge"`
Classify Classify `json:"classify"`
// Workflows override each workflow's manifest by workflow name.
Workflows map[string]WorkflowConfig `json:"workflows"`
// ProjectSettings maps an intent to a predicate over its pull request's
// facts: where it does not hold, the intent's sessions start without the
// checkout's own agent settings. An intent it does not name loads them.
ProjectSettings map[string]string `json:"project_settings"`
// Plugins switch each compiled-in plugin by provider id.
Plugins map[string]Plugin `json:"plugins"`
// 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"`
// Proposals sets the rules that propose drafts on their own.
Proposals Proposals `json:"proposals"`
Items Items `json:"items"`
Headless Headless `json:"headless"`
}
func (Config) AgentHomes ¶
AgentHomes lists every agent home the settings name.
func (Config) PlacementMap ¶
PlacementMap is c's placement rules as the placement service reads them.
func (Config) PluginEnabled ¶
PluginEnabled says whether the plugin id is on: a missing entry or a nil Enabled is.
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 "2d", "36h" or "90m" in the config.
func (Days) MarshalJSON ¶
MarshalJSON writes the form ParseDays reads: "2d", "36h", "2m".
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 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 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 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 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"`
TrustedAuthors []string `json:"trusted_authors"`
FollowupsWithoutWorkspace *bool `json:"followups_without_workspace"`
AddressWithoutWorkspace *bool `json:"address_without_workspace"`
}
Project matches repositories by an owner/repo pattern such as "acme/*" or "acme/infra". Empty fields keep the top-level value.
type ProposalApproval ¶
type ProposalRule ¶
type ProposalRule struct {
Approval *ProposalApproval `json:"approval,omitempty"`
}
type Proposals ¶
type Proposals struct {
RenudgeAfter Days
Rules map[string]ProposalRule
}
Proposals holds the settings of the rules that propose drafts on their own: how long a nudged, discarded, sent or observed proposal keeps its rule from proposing it again, and each rule's approval by rule id ("stalled-nudge", "closure", "ask-owner", "github-nudge"). In JSON the rules sit beside "renudge_after".
func (Proposals) Approval ¶
Approval is rule's configured approval, always when the config sets none.
func (Proposals) MarshalJSON ¶
func (*Proposals) UnmarshalJSON ¶
type Rounds ¶
type Rounds struct {
PerPRPerDay int `json:"per_pr_per_day"`
}
Rounds caps the automatic rounds: PerPRPerDay stops a runaway loop on one pull request, counted per local day.
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 {
// 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"`
}
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"`
MaxCall float64 `json:"max_call_usd,omitempty"`
MaxDay float64 `json:"max_day_usd,omitempty"`
MaxCalls int `json:"max_day_calls,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 UnknownKeysError ¶
type UnknownKeysError struct {
File string
Keys []string // paths such as "sweep.fsat" or "projects[0].agent_hom"
}
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 {
Mode string `json:"mode,omitempty"`
Enabled *bool `json:"enabled,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"`
}