/**
 * GoalTicker — periodic bridge that turns the active /goal into queued
 * missions, gated by governance.
 *
 * Phase 2 (Goal→Mission Bridge) of the autonomous-agent milestone.
 *
 * On each tick: if the active goal changed since it was last compiled
 * (DreamGoalStore.getActiveGoal().needsCompile), compile it into mission
 * drafts, run each draft through the governance gate, enqueue the allowed
 * ones, and mark the goal compiled (so re-ticking without a goal change is a
 * no-op — idempotent).
 *
 * Governance gate (3-way):
 *   - allowed                       → enqueue
 *   - !allowed && requiresConsent   → HOLD: emit a consent event, do NOT
 *                                     enqueue. Interactive approval (Telegram)
 *                                     is a later refinement; for now the held
 *                                     draft is surfaced, not silently dropped.
 *   - !allowed && !requiresConsent  → SKIP: hard block (e.g. prompt
 *                                     injection); recorded, never enqueued.
 *
 * Decoupled from the scheduler via the injected `enqueue` callback so it is
 * unit-testable without the orchestration stack.
 */
import { DreamGoalStore } from './DreamGoalStore';
import { GoalCompiler, MissionDraft } from './GoalCompiler';
import { GovernanceLayer, GovernanceDecision } from './GovernanceLayer';
import type { MissionSpec } from './QueueScheduler';
export type EnqueueFn = (spec: Omit<MissionSpec, 'enqueuedAt' | 'status' | 'attempts'>) => MissionSpec;
export interface GoalTickerOptions {
    store?: DreamGoalStore;
    compiler?: GoalCompiler;
    governance?: GovernanceLayer;
    /** Wires the ticker to the queue. Required for real use. */
    enqueue: EnqueueFn;
    /** Fired when a draft is held pending consent. */
    onConsentRequired?: (draft: MissionDraft, decision: GovernanceDecision) => void;
    /** Fired when a draft is hard-blocked. */
    onBlocked?: (draft: MissionDraft, decision: GovernanceDecision) => void;
    /** Tick cadence. Default 300_000ms (5min). */
    intervalMs?: number;
}
export interface TickOutcome {
    compiled: number;
    enqueued: number;
    held: number;
    blocked: number;
    source: 'llm' | 'heuristic' | 'error' | 'noop';
}
export declare class GoalTicker {
    private readonly store;
    private readonly compiler;
    private readonly governance;
    private readonly enqueueFn;
    private readonly onConsentRequired?;
    private readonly onBlocked?;
    private readonly intervalMs;
    private timer;
    private ticking;
    constructor(opts: GoalTickerOptions);
    /** Start the periodic tick. Performs an immediate tick. Idempotent. */
    start(): void;
    stop(): void;
    /**
     * One compile→gate→enqueue pass. Safe to call manually (tests). Re-entrancy
     * guarded so overlapping ticks don't double-compile.
     */
    tick(): Promise<TickOutcome>;
    /** Stable mission id: goal-scoped so re-enqueue of the same draft collides intentionally. */
    private missionId;
}
