/** * Darwin — Persisted Evolution Enable/Disable State * * `darwin evolve --enable|--disable` used to mutate the in-memory * agent singleton (`agent.evolution.enabled = true`) and never persist it, * so the flag was lost the moment the process exited — and `darwin run` * then read the STATIC source default again. This module makes the toggle * durable by recording it in {@link DarwinState.evolutionEnabled} (the same * JSON state blob every backend already round-trips) and resolving the * effective value with the persisted override winning over the static * default. */ import type { AgentDefinition, DarwinState, EvolutionConfig, EvolutionConfigOverride, MemoryProvider } from '../types.js'; /** * The effective "is evolution enabled for this agent" decision. * * Resolution order: * 1. A persisted override in `state.evolutionEnabled[agentName]` (set by * `darwin evolve --enable/--disable`) — wins when present. * 2. The agent definition's static `evolution.enabled` default. * 3. `false` when the agent has no `evolution` block at all. * * Read defensively: state written before the `evolutionEnabled` field * existed simply lacks the key, in which case rule 1 is skipped and the * static default applies — so old installs keep their previous behaviour. */ export declare function resolveEvolutionEnabled(agent: AgentDefinition, state: Pick): boolean; /** * Persist the enable/disable override for an agent atomically. * * Uses {@link MemoryProvider.updateState} so a concurrent writer cannot lose * the update, and initialises the `evolutionEnabled` map lazily for state * rows that predate the field. */ export declare function setEvolutionEnabled(memory: MemoryProvider, agentName: string, enabled: boolean): Promise; /** * Resolve the effective {@link EvolutionConfig} for an agent: the static * definition's `evolution` block with any persisted override * ({@link DarwinState.evolutionConfigOverrides}) merged ON TOP, then any * in-this-process CLI override merged last (e.g. `darwin run … --gepa`). * * Only the advanced flags in {@link OVERRIDE_KEYS} are overridable; every * other field (`enabled`, `metrics`, `minRuns`, …) is taken verbatim from the * static config. Returns `undefined` when the agent has no `evolution` block * AND no persisted/CLI override would create one — overriding a flag on an * agent that never opted into evolution is meaningless. * * Read defensively: undefined override values are skipped so they never clobber * a static default with `undefined`. */ export declare function resolveEvolutionConfig(agent: AgentDefinition, state: Pick, cliOverride?: EvolutionConfigOverride): EvolutionConfig | undefined; /** * Persist advanced-config overrides for an agent atomically, merging the given * partial into any existing override map (so toggling `--gepa` does not wipe a * previously-set `--reflection-model`). Initialises the map lazily for state * rows that predate the field. */ export declare function setEvolutionConfigOverrides(memory: MemoryProvider, agentName: string, partial: EvolutionConfigOverride): Promise; //# sourceMappingURL=enabled-state.d.ts.map