import { type NormalizedPolicy, type PolicyIsolation } from "../policy/index.js"; import type { RunWorkItemInput } from "../work/index.js"; import { type GovernorRunReport, type GovernorStopReason } from "./runner.js"; import { type GovernorRecord } from "./state.js"; export declare const GOVERNOR_SERVICE_CONFIG_SCHEMA_VERSION: 1; export declare const GOVERNOR_SERVICE_RUNTIME_SCHEMA_VERSION: 1; export declare const GOVERNOR_SERVICE_STATUS_SCHEMA_VERSION: 1; export interface GovernorServiceEngineConfig { default_adapter?: string; cwd?: string; subscription_only: boolean; allow_api_billing: boolean; policy?: NormalizedPolicy; isolation?: PolicyIsolation; approval_addressee?: string; } export interface GovernorServiceConfig { schema_version: typeof GOVERNOR_SERVICE_CONFIG_SCHEMA_VERSION; goal_ids: string[]; wake_interval_ms: number; heartbeat_interval_ms: number; error_backoff_base_ms: number; error_backoff_max_ms: number; engine: GovernorServiceEngineConfig; created_at: string; } export interface ConfigureGovernorServiceInput { coordRoot: string; goalIds: readonly string[]; wakeIntervalMs?: number; heartbeatIntervalMs?: number; errorBackoffBaseMs?: number; errorBackoffMaxMs?: number; engine?: Partial; } export type GovernorServiceGoalState = "idle" | "backoff" | "awaiting_change"; export interface GovernorServiceGoalRuntime { state: GovernorServiceGoalState; consecutive_errors: number; observed_fingerprint?: string; next_wake_at?: string; last_tick_at?: string; last_stop_reason?: GovernorStopReason; last_error?: string; } export interface GovernorServiceRuntime { schema_version: typeof GOVERNOR_SERVICE_RUNTIME_SCHEMA_VERSION; config_created_at: string; updated_at: string; goals: Record; } export type GovernorServiceProcessState = "starting" | "running" | "stopping" | "stopped"; export interface GovernorServiceStatusRecord { schema_version: typeof GOVERNOR_SERVICE_STATUS_SCHEMA_VERSION; pid: number; host: string; nonce: string; state: GovernorServiceProcessState; started_at: string; heartbeat_at: string; config_created_at: string; sweep_count: number; active_goal_id?: string; last_sweep_at?: string; next_wake_at?: string; last_error?: string; stopped_at?: string; } export interface GovernorServiceStatus { running: boolean; stale: boolean; record?: GovernorServiceStatusRecord; config?: GovernorServiceConfig; runtime?: GovernorServiceRuntime; } export interface GovernorServiceSweepOutcome { goal_id: string; action: "tick" | "skip" | "backoff"; reason: string; stop_reason?: GovernorStopReason; next_wake_at?: string; } export interface GovernorServiceSweepReport { started_at: string; ended_at: string; outcomes: GovernorServiceSweepOutcome[]; } export interface RunGovernorServiceSweepInput { coordRoot: string; config: GovernorServiceConfig; engine?: Omit; actor?: string; now?: () => number; readGoal?: (coordRoot: string, goalId: string) => GovernorRecord; runGoal?: (goalId: string) => Promise; onGoalStart?: (goalId: string) => void; } export interface RunGovernorServiceDaemonInput { coordRoot: string; engine: Omit; actor?: string; maxSweeps?: number; onLog?: (line: string) => void; } export declare function configureGovernorService(input: ConfigureGovernorServiceInput): GovernorServiceConfig; export declare function readGovernorServiceConfig(coordRootRaw: string): GovernorServiceConfig; export declare function readGovernorServiceRuntime(coordRootRaw: string): GovernorServiceRuntime | undefined; export declare function readGovernorServiceStatus(coordRootRaw: string): GovernorServiceStatus; export declare function spawnGovernorService(coordRootRaw: string): Promise; export declare function requestGovernorServiceStop(coordRootRaw: string): GovernorServiceStatus; export declare function runGovernorServiceSweep(input: RunGovernorServiceSweepInput): Promise; export declare function runGovernorServiceDaemon(input: RunGovernorServiceDaemonInput): Promise; export declare function governorServiceLogPath(coordRoot: string): string; export declare function appendGovernorServiceDiagnostic(coordRoot: string, data: Record): "shared" | "legacy"; //# sourceMappingURL=service.d.ts.map