/**
 * Orchestrator Adapter SDK -- public interface surface
 *
 * Defines the abstract interface that every orchestrator adapter must
 * implement, the canonical audit-event taxonomy, the reviewer-tier model,
 * the error hierarchy, and the supporting context/decision types.
 *
 * The governance runtime dispatches plan approval, task governance,
 * delegation routing, reviewer-queue insertion, and audit-chain emission
 * through this interface. No orchestrator-specific branching is permitted
 * in the runtime layer -- all orchestrator logic lives in the adapters.
 *
 * Spec: P3-ORCH-01, AC 1-3, AC 20, Section 3.1-3.4
 * Depends on: P3-SUB-01 (LlmProviderError hierarchy)
 *
 * @connexum/ai-governance
 */
export { LlmProviderError } from '../llm-adapters/index.js';
import { LlmProviderError } from '../llm-adapters/index.js';
export { ActionDecisionType } from '../adapters/index.js';
// ---------------------------------------------------------------------------
// Error hierarchy (AC 20, Section 2.10)
// ---------------------------------------------------------------------------
/**
 * Base orchestrator error. Extends LlmProviderError so orchestrator errors
 * are a subtype of the P3-SUB-01 hierarchy and can be handled uniformly.
 */
export class OrchestratorError extends LlmProviderError {
    constructor(opts) {
        super({
            message: opts.message,
            code: opts.code,
            providerId: opts.orchestratorId ?? 'unknown-orchestrator',
            adapterId: opts.adapterId ?? 'unknown-adapter',
            raw: opts.raw,
        });
        this.name = 'OrchestratorError';
    }
}
/**
 * The adapter does not support the requested surface.
 * Thrown instead of returning null, undefined, or a silent ALLOW.
 */
export class OrchestratorUnsupportedError extends OrchestratorError {
    /** The surface that is not supported (e.g. 'delegation', 'parallelExecution') */
    surface;
    constructor(opts) {
        super({ ...opts, code: 'ORCHESTRATOR_UNSUPPORTED' });
        this.name = 'OrchestratorUnsupportedError';
        this.surface = opts.surface;
    }
}
/**
 * A submitted plan is structurally invalid (empty steps, cycle, undefined deps).
 * Thrown synchronously at prePlan() time; partial-execution fallback is prohibited.
 */
export class PlanValidationError extends OrchestratorError {
    planId;
    failedStepIds;
    constructor(opts) {
        super({ ...opts, code: 'PLAN_VALIDATION_FAILED' });
        this.name = 'PlanValidationError';
        this.planId = opts.planId;
        this.failedStepIds = opts.failedStepIds;
    }
}
/**
 * Delegation was denied by policy.
 */
export class DelegationDeniedError extends OrchestratorError {
    fromAgent;
    toAgent;
    deniedPermissions;
    constructor(opts) {
        super({ ...opts, code: 'DELEGATION_DENIED' });
        this.name = 'DelegationDeniedError';
        this.fromAgent = opts.fromAgent;
        this.toAgent = opts.toAgent;
        this.deniedPermissions = opts.deniedPermissions;
    }
}
/**
 * A role was referenced that is not registered with the adapter.
 * Thrown at the point of first task dispatch into that role.
 */
export class RoleNotRegisteredError extends OrchestratorError {
    role;
    constructor(opts) {
        super({ ...opts, code: 'ROLE_NOT_REGISTERED' });
        this.name = 'RoleNotRegisteredError';
        this.role = opts.role;
    }
}
/**
 * Reviewer routing failed: the requested tier has no queue binding,
 * or the adapter was initialized without any reviewer-queue binding.
 */
export class ReviewerRoutingError extends OrchestratorError {
    requestedTier;
    constructor(opts) {
        super({ ...opts, code: 'REVIEWER_ROUTING_FAILED' });
        this.name = 'ReviewerRoutingError';
        this.requestedTier = opts.requestedTier;
    }
}
//# sourceMappingURL=index.js.map