Documentation
¶
Overview ¶
Package factoryenv turns the FACTORY_* and GITHUB_APP_* environment into the options of the agent factory. It is shared by the processes that must install the same factory: harness-web (which dispatches tasks and serves the API) and harness-worker (which executes the runs, so it must fire the end-of-run hooks, serve the tools and enforce the policy and the budget of the tasks it runs).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Wiring ¶
type Wiring struct {
Options harness.FactoryOptions
Escalator *product.FactoryEscalator
Hooks *product.FactoryHooks
}
Wiring is what FACTORY_* turns into: the facade's options and the escalator and hooks the product binds to.
func FromEnv ¶
func FromEnv(getenv func(string) string, cfg *config.Config, st factory.Store, gh *product.GitHubApp, team store.TeamStore) (Wiring, bool, error)
FromEnv reads the FACTORY_* variables. The factory is off (enabled false) unless FACTORY=1.
FACTORY=1 turn the agent factory on (team mode) FACTORY_RUN=0 do not run the dispatcher, scheduler and PR loop in this process (default 1) FACTORY_WEBHOOK_SECRET GitHub webhook secret (POST /hooks/github); without it deliveries are refused FACTORY_REVIEW_MODEL model of the independent reviewer that gates merges (needs the GitHub App) FACTORY_NO_REVIEW=1 merge on green CI without the reviewer (deliberate opt-out) FACTORY_REQUIRE_TESTS=1 the reviewer flags source changes that touch no test FACTORY_PROTECTED comma-separated path globs no agent change may touch FACTORY_MAX_CONCURRENT tasks running at once (default 4) FACTORY_MAX_ATTEMPTS attempts per task (default 3) FACTORY_POLICY default autonomy: supervised | sandboxed | autonomous (default sandboxed) (a task's budget is set by whoever creates the task or the trigger; there is no global one) FACTORY_DAILY_BUDGET_USD / _TOKENS cap on all factory spend per 24h (FACTORY_DAILY_PER_PROJECT=1: per project) FACTORY_LESSONS=1 distil lessons from finished tasks into project memory
st is the task store (nil: in memory, nothing survives the process; harness-web passes a file-backed or Postgres one). team links the threads of a task to its project; nil leaves them private to the owner, which is what a process without the team store wants.