/** * Governor Runner -- Programmatic API for the governor CLI. * * Exports `runGovernor()` so the governor can be invoked from code * (e.g. Next.js route handlers, tests, or custom scripts) without going * through process.argv / process.env / process.exit. */ import { WorkflowGovernor, EventDrivenGovernor, type GovernorDependencies, type GovernorEventBus, type EventDeduplicator } from '@renseiai/agentfactory'; import type { ScanResult } from '@renseiai/agentfactory'; export interface GovernorRunnerConfig { /** Projects to scan */ projects: string[]; /** Scan interval in milliseconds (default: 60000) */ scanIntervalMs?: number; /** Maximum concurrent dispatches per scan (default: 3) */ maxConcurrentDispatches?: number; /** Enable auto-research from Icebox (default: false) */ enableAutoResearch?: boolean; /** Enable auto-backlog-creation from Icebox (default: false) */ enableAutoBacklogCreation?: boolean; /** Enable auto-development from Backlog (default: true) */ enableAutoDevelopment?: boolean; /** Enable auto-QA from Finished (default: true) */ enableAutoQA?: boolean; /** Enable auto-acceptance from Delivered (default: true) */ enableAutoAcceptance?: boolean; /** Run a single scan pass and exit (for testing / cron) */ once?: boolean; /** Dependency injection for the governor (required) */ dependencies: GovernorDependencies; /** Callbacks for governor lifecycle events */ callbacks?: GovernorRunnerCallbacks; /** Governor execution mode (default: 'poll-only') */ mode?: 'poll-only' | 'event-driven'; /** Event bus for event-driven mode (created automatically if not provided) */ eventBus?: GovernorEventBus; /** Event deduplicator for event-driven mode (created automatically if not provided) */ deduplicator?: EventDeduplicator; } export interface GovernorRunnerCallbacks { onScanComplete?: (results: ScanResult[]) => void | Promise; onError?: (error: Error) => void; } export interface GovernorRunnerResult { governor: WorkflowGovernor | EventDrivenGovernor; /** Only populated in --once mode (poll-only) */ scanResults?: ScanResult[]; } /** * Start the Workflow Governor with the given configuration. * * In `poll-only` mode (default): * - `once` mode: runs a single scan pass and returns the results. * - Otherwise: starts the scan loop and returns the governor instance * (caller is responsible for calling `governor.stop()` on shutdown). * * In `event-driven` mode: * - Creates an EventDrivenGovernor with an event bus and optional deduplicator. * - Starts the event loop and periodic poll sweep. * - `once` mode is not supported in event-driven mode (falls back to poll-only). */ export declare function runGovernor(config: GovernorRunnerConfig): Promise; export interface GovernorCLIArgs { projects: string[]; scanIntervalMs: number; maxConcurrentDispatches: number; enableAutoResearch: boolean; enableAutoBacklogCreation: boolean; enableAutoDevelopment: boolean; enableAutoQA: boolean; enableAutoAcceptance: boolean; once: boolean; mode: 'poll-only' | 'event-driven'; autoUpdate?: boolean; } /** * Parse CLI arguments for the governor command. * * Usage: * agentfactory governor --project [--project ] [options] * * Options: * --project Project to scan (can be repeated) * --scan-interval Scan interval in milliseconds (default: 60000) * --max-dispatches Maximum concurrent dispatches per scan (default: 3) * --auto-research Enable auto-research from Icebox (default: off) * --auto-backlog-creation Enable auto-backlog-creation from Icebox (default: off) * --no-auto-research Disable auto-research (explicit override) * --no-auto-backlog-creation Disable auto-backlog-creation (explicit override) * --no-auto-development Disable auto-development from Backlog * --no-auto-qa Disable auto-QA from Finished * --no-auto-acceptance Disable auto-acceptance from Delivered * --once Run a single scan pass and exit * --auto-update Enable automatic updates * --no-auto-update Disable automatic updates * --help, -h Show help */ export declare function parseGovernorArgs(argv?: string[]): GovernorCLIArgs; /** * Print help text for the governor command. */ export declare function printGovernorHelp(): void; //# sourceMappingURL=governor-runner.d.ts.map