import type { DomainId, PhaseRequiredField, QualityContract, QualityContractMode, WorkflowPhase } from '../types/index.js'; export declare const CONTRACT_REGISTRY: Record; export type HandoffQualityResult = { passed: boolean; violations: string[]; mode: QualityContractMode; }; export type HandoffContentResult = { valid: boolean; warnings: string[]; }; export type PhaseSubstanceResult = { passed: boolean; violations: string[]; }; export type RequiredFieldsResult = { valid: boolean; missing: PhaseRequiredField[]; }; export type EscalationEvent = { type: 'quality-escalation'; timestamp: string; taskId: string; phase: string; role: string; violations: string[]; missingFields: PhaseRequiredField[]; severity: 'info' | 'warning' | 'critical'; }; /** * Resolves the applicable quality contract for a given phase/profile. * Checks workspace config first; falls back to defaults. */ export declare function resolveQualityContract(cwd: string, phase: WorkflowPhase, profile: string): QualityContract; /** * Validates whether a task has sufficient evidence/decisions for a handoff. */ export declare function validateHandoffQuality(cwd: string, storyId: string, phase: WorkflowPhase, profile: string): HandoffQualityResult; /** * Validates handoff content to reject generic/empty summaries. */ export declare function validateHandoffContent(summary: string, evidenceIds: string[]): HandoffContentResult; export declare function validatePhaseSubstance(cwd: string, storyId: string, phase: WorkflowPhase, profile: string): PhaseSubstanceResult; export type GateSubstanceInput = { /** Acceptance criteria carried by the handoff being gated. */ acceptanceCriteria: string[]; /** Evidence IDs mapped to the handoff/story at the gate. */ evidenceIds: string[]; /** True when this transition pauses for a human review. */ reviewRequired: boolean; /** True when a review record for this gate exists. */ reviewRecorded: boolean; }; export type GateSubstanceResult = { passed: boolean; violations: string[]; }; /** * Asserts that a gated handoff carries *substance*, not just structure (GH-599). * A gate fails when: acceptance criteria are missing/empty or degenerate to a * generic `none`/`n/a`; acceptance criteria exist but no evidence is mapped to * back them; or a human-reviewed gate has no recorded review. Pure function — * the caller decides whether to block or warn. */ export declare function validateGateSubstance(input: GateSubstanceInput): GateSubstanceResult; /** * Validates that all required fields defined in a contract are present in the * provided field set. */ export declare function validateRequiredFields(contract: QualityContract, providedFields: Set): RequiredFieldsResult; /** * Emits a structured escalation event to stderr for consumption by * orchestration tooling or observability pipelines. */ export declare function emitEscalation(event: EscalationEvent): void; /** * Applies domain-specific escalation rules to a contract when the workspace * operates in a regulated domain. Returns a new contract with additional * checks merged and mode elevated to 'escalate' if applicable. */ export declare function applyDomainEscalation(contract: QualityContract, workspaceDomains: DomainId[]): QualityContract; /** * Returns a contract for a role with domain escalation applied from workspace config. */ export declare function resolveQualityContractWithDomain(cwd: string, phase: WorkflowPhase, profile: string): QualityContract;