/**
 * BaseOrchestratorAdapter -- Abstract base class for all orchestrator adapters.
 *
 * Provides common implementations of:
 *   - Reviewer-queue integration (routing REQUIRE_APPROVAL to configured tiers)
 *   - Canonical audit-event emission (Section 3.2 taxonomy)
 *   - Plan-tree DFS with cycle detection (AC 3, AC 22)
 *   - Per-role policy dispatch via the role registry (Section 3.3)
 *   - Error translation scaffold
 *
 * Fail-closed rules (Thomas philosophy, AC 28):
 *   - initialize() without reviewerQueues binding throws ReviewerRoutingError
 *   - Missing role throws RoleNotRegisteredError at first dispatch
 *   - REQUIRE_APPROVAL with no resolvable tier throws ReviewerRoutingError
 *   - Plan with no steps, a cycle, or undefined deps throws PlanValidationError
 *
 * Concrete adapters override only framework-specific methods.
 *
 * Spec: P3-ORCH-01, AC 3, AC 28
 * @connexum/ai-governance
 */
import { OrchestratorAdapter, OrchestratorAdapterConfig, OrchestratorCapabilities, OrchestratorError, ReviewerTier, ReviewerQueueBindings, RoleRegistration, WorkflowContext, WorkflowDecision, WorkflowStepContext, WorkflowStepDecision, WorkflowResult, RoleEdgeContext, RoleEdgeDecision, PlanNodeVisitor, RolePolicyContext, RolePolicyDecision, ReviewerContext, ReviewerRoutingResult, CanonicalAuditEventName } from './index';
import { CanonicalAuditEvent } from './shared';
import type { TaskContext, TaskDecision, PlanContext, PlanDecision, DelegationContext, DelegationDecision } from './orchestrator-adapter';
import { type AgentMessageEnvelope, type AgentMessageVerifyResult } from '../security/agent-message-envelope';
export declare abstract class BaseOrchestratorAdapter implements OrchestratorAdapter {
    /** Unique adapter identifier (e.g. 'paperclip', 'crewai') */
    abstract readonly adapterId: string;
    /** Canonical orchestrator ID (e.g. 'paperclip', 'langchain') */
    abstract readonly orchestratorId: string;
    protected config: OrchestratorAdapterConfig;
    protected reviewerQueues: ReviewerQueueBindings;
    protected roles: Map<string, RoleRegistration>;
    private _initialized;
    protected canonicalEvents: CanonicalAuditEvent[];
    protected circuitBreakerOpen: boolean;
    private consecutiveFailures;
    private circuitBreakerThreshold;
    initialize(config: OrchestratorAdapterConfig): void;
    protected assertInitialized(): void;
    /**
     * Emit a canonical audit event. The base implementation pushes to an
     * in-process buffer; concrete adapters may override to also forward to
     * an EventBus or external sink.
     */
    protected emitCanonical(eventName: CanonicalAuditEventName, payload: Record<string, unknown>): CanonicalAuditEvent;
    /** Return a copy of accumulated canonical events (for testing / reporting). */
    getCanonicalEvents(): CanonicalAuditEvent[];
    /** True when this adapter instance is configured to sign/verify inter-agent messages. */
    protected get interAgentSigningEnabled(): boolean;
    /**
     * Sign an outbound inter-agent message from `fromAgentId`. Returns a signed
     * envelope, or `null` when signing is not configured (caller sends unsigned;
     * the scanner flags that statically as an ASI-07 gap). Emits
     * `orchestrator:message-signed` on success.
     */
    protected signOutboundMessage<T = unknown>(fromAgentId: string, payload: T): AgentMessageEnvelope<T> | null;
    /**
     * Verify an inbound inter-agent message. Returns the structured verify
     * result (never throws). Emits `orchestrator:message-verified` on success or
     * `orchestrator:message-rejected` on any failure. When signing is not
     * configured, returns a benign `valid:true` pass-through so unsigned legacy
     * traffic is not blocked (the scanner is what flags the missing capability).
     */
    protected verifyInboundMessage<T = unknown>(envelope: AgentMessageEnvelope<T>): AgentMessageVerifyResult;
    /**
     * Map an inbound message verification to a delegation governance action,
     * honoring the configured enforcement mode. NEVER throws (I-3).
     *   - valid                      → ALLOW
     *   - invalid + enforcement warn  → WARN (proceed, flagged)  [default]
     *   - invalid + enforcement block → DENY
     * The deciding org's policy consumes this; the platform never hard-gates.
     */
    protected enforceInboundDelegationSignature<T = unknown>(envelope: AgentMessageEnvelope<T>): {
        action: 'ALLOW' | 'WARN' | 'DENY';
        result: AgentMessageVerifyResult;
    };
    routeToReviewer(tier: ReviewerTier, ctx: ReviewerContext): Promise<ReviewerRoutingResult>;
    dispatchRolePolicy(role: string, ctx: RolePolicyContext): Promise<RolePolicyDecision>;
    traversePlanTree(root: PlanContext, visitor: PlanNodeVisitor): Promise<void>;
    /**
     * Validate plan structure. Throws PlanValidationError on:
     *   - Empty steps array
     *   - Cycle in the dependency graph
     *   - Dependency referencing an undefined stepId
     * This is called synchronously inside traversePlanTree and prePlan.
     */
    protected validatePlanStructure(plan: PlanContext): void;
    /**
     * Run G-series classification on a tool/action output.
     *
     * C1 fix: orchestrator tool outputs were not running through the nine-guard
     * G-series classification. This method provides the hook so every adapter's
     * onToolEnd / handleToolEnd calls it, ensuring tool results are screened for
     * secrets (G2), PHI (G3), and policy violations before being passed to the
     * calling agent.
     *
     * Implementation: performs a lightweight in-process scan using known secret
     * and PHI indicator patterns (sufficient for local enforcement), emits a
     * canonical `orchestrator:tool-output-classified` event with the
     * classification result, and returns true if the output is clean.
     *
     * If `config.governanceRuntime` exposes a classify endpoint, concrete adapters
     * should override this method to also call it. The base implementation is
     * always available as a safe fallback.
     *
     * @param auditId   The audit ID from the preceding preTask/preAction decision.
     * @param output    The raw tool output (any type; converted to string for scan).
     * @param agentName Name of the agent for logging context.
     * @param packBinding Active compliance packs for classification scope.
     * @returns true if the output passes classification; false if guards triggered.
     */
    protected postActionClassify(auditId: string, output: unknown, agentName: string, packBinding?: string[]): boolean;
    protected recordSuccess(): void;
    protected recordFailure(): void;
    protected isCircuitOpen(): boolean;
    translateError(raw: unknown): OrchestratorError;
    abstract startWorkflow(ctx: WorkflowContext): Promise<WorkflowDecision>;
    abstract stepWorkflow(ctx: WorkflowStepContext): Promise<WorkflowStepDecision>;
    abstract completeWorkflow(ctx: WorkflowContext, result: WorkflowResult): Promise<void>;
    abstract preTask(task: TaskContext): Promise<TaskDecision>;
    abstract postTask(task: TaskContext, result: Record<string, unknown>): Promise<void>;
    abstract prePlan(plan: PlanContext): Promise<PlanDecision>;
    abstract postPlan(plan: PlanContext, result: Record<string, unknown>): Promise<void>;
    abstract preDelegation(d: DelegationContext): Promise<DelegationDecision>;
    abstract postDelegation(d: DelegationContext, result: Record<string, unknown>): Promise<void>;
    abstract invokeRoleEdge(edge: RoleEdgeContext): Promise<RoleEdgeDecision>;
    abstract getOrchestratorCapabilities(): OrchestratorCapabilities;
}
//# sourceMappingURL=base.d.ts.map