/** * The learn schedule's tick (DES-learn-workflow ยง5.3). Once a minute: * * 1. RECONCILE โ€” a schedule's last run that reached a terminal status records its outcome. * 2. INDEX โ€” a topic whose MERGED knowledge changed (`git fetch origin `, then * `git rev-parse origin/:.wicked/knowledge/`; the checkout's working copy is never read) * moved) is re-indexed into the estate knowledge store by garden's `scripts/learn/index.py`, * spawned OUTSIDE any run (its env carries no run markers, so the estate opens writable), one * spawn per sweep. Indexing reads the registered checkout, never an open pull request. * 3. LAUNCH โ€” at most ONE due schedule launches the `learn` workflow, and only while no schedule's * run is still open and no run on the daemon is executing (one governed run at a time). The * launch delivers a pull request behind the engine's human deliver gate; nothing auto-merges. * A refused launch backs off exponentially (capped at a day); missed intervals coalesce. * * Never throws; a slow sweep never stacks (`sweeping`). */ import type { CoreAdapter } from '../core/adapter.js'; import type { Actor, CoreEvent } from '../core/types.js'; import type { AuditLog } from '../api/audit.js'; import { type RunTimingIndex } from '../api/run-timing-index.js'; import { type LearnSchedule, type LearnScheduleStore } from './schedule-store.js'; export declare const LEARN_WORKFLOW = "learn"; export declare const LEARN_SCHEDULE_ACTOR: Actor; export declare const DEFAULT_LEARN_SWEEP_MS = 60000; /** How long a launched run the daemon no longer lists keeps the schedule's slot (48 h). */ export declare const STALE_LAUNCH_MS: number; /** The env a governed unit carries; the index spawn drops every one so estate opens writable. */ export declare const RUN_MARKER_ENV: string[]; export interface ExecResult { code: number; stdout: string; stderr: string; } export type Exec = (cmd: string, args: string[], opts: { cwd?: string; env?: NodeJS.ProcessEnv; timeoutMs: number; }) => Promise; export declare const defaultExec: Exec; export interface LearnSchedulerDeps { store: LearnScheduleStore; adapter: Pick; audit: AuditLog; runTimingIndex: RunTimingIndex; fileRun: (runId: string, projectId: string) => void; broadcast: (frame: CoreEvent) => void; log: (msg: string) => void; now?: () => Date; exec?: Exec; env?: NodeJS.ProcessEnv; /** The live garden plugin root (tests inject it); default: the skills runtime's discovery. */ gardenRoot?: () => string | null; } /** The garden root the indexer runs from: `$WICKED_GARDEN_ROOT`, else the live plugin the daemon's * skills runtime publishes from (E2E F-LEARN-5: an inherited `CLAUDE_PLUGIN_ROOT` pointing at an * older checkout must never pick the script), else null (`wicked-garden` on PATH). */ export declare function gardenRootFor(env: NodeJS.ProcessEnv, live?: () => string | null): string | null; /** The garden launcher under a root (`/scripts/wicked-garden`), else `wicked-garden` on PATH. */ export declare function gardenLauncher(root: string | null): string; /** `env` without the governed-run markers, pinned to the garden root it resolved (and no inherited * `CLAUDE_PLUGIN_ROOT`, which the launcher would otherwise prefer). */ export declare function unmarkedEnv(env: NodeJS.ProcessEnv, root?: string | null): NodeJS.ProcessEnv; export declare function refreshProblem(row: LearnSchedule): string; export declare class LearnScheduler { private readonly deps; private timer; private sweeping; constructor(deps: LearnSchedulerDeps); start(intervalMs?: number): void; stop(): void; private now; /** One sweep. Never throws. */ sweep(): Promise; private reconcile; private indexOne; private launchOne; } //# sourceMappingURL=scheduler.d.ts.map