/**
 * WS5.2 §5.2 — Account Follow-Me service: composes the primitives into the depth-zero → consent
 * flow, and the mandate-delivered → proceed flow. Pure orchestration over INJECTED deps (pool
 * reader, consent emitter, enroll driver) so it is unit-testable WITHOUT spawning a server; the
 * HTTP route / scheduler tick later just constructs it with real deps.
 *
 * Two entry points:
 *   - scanAndOffer(): detect depth-zero enrollment candidates (R7-bounded), run each through the
 *     orchestrator (no operator mandate yet → consent-required), and emit ONE AGGREGATED consent
 *     item (P17 Bounded Notification Surface) — never one per machine. Never enrolls anything.
 *   - onMandateDelivered(): a portable account-follow-me mandate arrived from the operator machine
 *     → verify it (R4a bridge) → run the orchestrator with it → on allow, return an enroll-drive
 *     instruction for the caller to execute (per-server, OQ6). Still never self-authorizes.
 *
 * The service decides; the side effects (raising the attention item, driving the EnrollmentWizard,
 * SubscriptionPool.add) are injected so each is independently testable + swappable. PR2 increment 3b.
 */
import { type PoolMachineDepth, type OperatorAccount } from './AccountFollowMeDetector.js';
import { AccountFollowMeOrchestrator, type FollowMeConsentRequest, type FollowMeMechanism } from './AccountFollowMeOrchestrator.js';
import { type PortableMandate } from '../coordination/AccountFollowMeMandateBridge.js';
import type crypto from 'node:crypto';
export interface AggregatedConsent {
    /** Stable id so the attention item dedups per scan-set (one running item, not a flood). */
    id: string;
    title: string;
    body: string;
    priority: 'medium';
    source: 'agent';
    offers: FollowMeConsentRequest[];
}
export interface EnrollDriveInstruction {
    accountId: string;
    targetMachineId: string;
    mechanism: FollowMeMechanism;
    /** The verified mandate id authorizing this drive (audit). */
    mandateId: string;
}
export interface AccountFollowMeServiceDeps {
    /** Read the pool's per-machine account depth + the operator's accounts (WS5.1 / SubscriptionPool). */
    readPoolDepth: () => {
        machines: PoolMachineDepth[];
        accounts: OperatorAccount[];
    };
    /** Per-account max-follow-machines cap (R7). */
    maxFollowMachines: () => number;
    /** (account,target) pairs already offered/in-flight — never re-offered (`${accountId}::${targetMachineId}`). */
    inFlight: () => ReadonlySet<string>;
    /** The §5.2 orchestrator (request-never-self-authorize). */
    orchestrator: AccountFollowMeOrchestrator;
    /** Raise ONE aggregated consent attention item. */
    emitAggregatedConsent: (consent: AggregatedConsent) => void;
    log?: (msg: string) => void;
}
export declare class AccountFollowMeService {
    private readonly deps;
    constructor(deps: AccountFollowMeServiceDeps);
    /**
     * §5.2 scan: surface (never act on) the depth-zero enrollment offers. Runs each candidate through
     * the orchestrator — with no mandate yet, each yields consent-required — and emits ONE aggregated
     * consent item over all of them. Returns the consent requests surfaced (empty if none).
     */
    scanAndOffer(): {
        offered: FollowMeConsentRequest[];
    };
    /**
     * A portable account-follow-me mandate was delivered from the operator machine. Verify it (R4a),
     * then run the orchestrator with it. On allow, return an enroll-drive instruction; otherwise null
     * (verification failed, or the gate denied — never proceed, never self-authorize).
     */
    onMandateDelivered(args: {
        portable: PortableMandate;
        operatorEd25519PublicKey: crypto.KeyObject | string | Buffer;
        expectedOperatorMachineFingerprint: string;
        /** The (account,target,mechanism,email,nickname) this mandate is expected to authorize. */
        request: {
            accountId: string;
            accountEmail: string;
            targetMachineId: string;
            targetMachineNickname: string;
            mechanism?: FollowMeMechanism;
        };
    }): EnrollDriveInstruction | null;
}
//# sourceMappingURL=AccountFollowMeService.d.ts.map