/**
 * In-memory Guidance draft overlay + sampled impacts (read-only — no kit registry writes).
 */
import { type BuiltinRunCommandManifestRow } from "../../contracts/builtin-run-command-manifest.js";
import type { CaeEvaluateMode } from "./cae-evaluate.js";
import type { CaeEvaluationContext } from "./evaluation-context-types.js";
import { type CaeLoadedRegistry } from "./cae-registry-load.js";
import type { GuidanceScopeBuildResult } from "./guidance-scope-builder.js";
export declare const PREVIEW_DRAFT_ARTIFACT_ID = "cae.preview.draft.artifact";
export declare const PREVIEW_DRAFT_ACTIVATION_ID = "cae.preview.draft.activation";
export type DraftGuidanceRuleInputV1 = {
    schemaVersion: 1;
    title: string;
    artifactType?: string;
    /** Repo-relative `ref.path` — file must exist under workspace root. Defaults to `.ai/README.md`. */
    refPath?: string;
    family: "policy" | "think" | "do" | "review";
    priority: number;
    scopeDraft: unknown;
    acknowledgement?: {
        strength: "none" | "surface" | "recommend" | "ack_required" | "satisfy_required";
        token: string;
    };
};
export type PreviewPrimaryInput = {
    label?: string;
    commandName: string;
    moduleId?: string;
    taskId?: string;
    commandArgs?: Record<string, unknown>;
    argvSummary?: string;
};
export type DraftImpactSampleKind = "primary" | "contrast_workflow" | "broad_drift" | "completing_task_flow" | "planning_task";
export type DraftImpactSampleRowV1 = {
    schemaVersion: 1;
    label: string;
    sampleKind?: DraftImpactSampleKind;
    commandName: string;
    taskId?: string;
    baselineFamilyCounts: {
        policy: number;
        think: number;
        do: number;
        review: number;
    };
    overlayFamilyCounts: {
        policy: number;
        think: number;
        do: number;
        review: number;
    };
    draftVisibleInOverlay: boolean;
};
/** Product-facing mapping of authoring scope presets to coarse blast buckets (T1002). */
export type BlastRadiusScopeBucket = "always_global" | "workflow_intent" | "phase" | "task_selector" | "task_tag" | "completing_task" | "advanced_command" | "unknown_custom";
export type BlastRadiusSummaryV1 = {
    schemaVersion: 1;
    draftScopeCategory: BlastRadiusScopeBucket;
    totalSamplesEvaluated: number;
    samplesWhereDraftMatched: number;
    representativeMatchedLabels: string[];
    planningTasksIncluded: number;
    /** Counts of samples (where the draft surfaced) keyed by DraftImpactSampleKind */
    tallyBySampleKindWhereDraftMatched: Partial<Record<DraftImpactSampleKind, number>>;
};
export type ActivationReadinessReasonV1 = {
    code: string;
    message: string;
    severity: "info" | "warn" | "block";
};
export type ActivationReadinessV1 = {
    schemaVersion: 1;
    /** Conservative enablement posture before publishing a Guidance version */
    level: "ok" | "warning" | "stop_confirm";
    reasons: ActivationReadinessReasonV1[];
    primaryPreviewTraceId: string;
    conflictEntryCount: number;
    conflictsInvolvingDraft: number;
    sameFamilyConflictSubset: Record<string, unknown>[];
    usefulnessSignal: "absent" | "useful" | "noisy";
    overlayPendingAckCount: number;
    baselinePendingAckCount: number;
    acknowledgementDelta: number;
};
export type GuidanceDraftImpactV1 = {
    schemaVersion: 1;
    draftArtifactId: string;
    draftActivationId: string;
    scopePreset: GuidanceScopeBuildResult["preset"] | "unknown";
    scopePlainSummary: string;
    overlayRegistryDigestSnippet: string;
    scopeWarnings: GuidanceScopeBuildResult["warnings"];
    scopeErrors: GuidanceScopeBuildResult["errors"];
    broadScopeWarnings: {
        code: string;
        message: string;
    }[];
    primarySampleLabel: string;
    samples: DraftImpactSampleRowV1[];
    blastRadiusSummary: BlastRadiusSummaryV1;
    activationReadiness: ActivationReadinessV1;
};
/** Validates authoring JSON for `cae-guidance-preview` `{ draftRule: ... }`. */
export declare function coerceDraftGuidanceRuleInput(raw: unknown): {
    ok: false;
    code: string;
    message: string;
} | {
    ok: true;
    value: DraftGuidanceRuleInputV1;
};
export declare function builtinManifestRowForCommand(name: string): BuiltinRunCommandManifestRow | undefined;
export declare function resolveBuiltinModuleId(commandName: string, fallback?: string): string;
export declare function collectBroadScopeWarnings(scopeBuild: GuidanceScopeBuildResult): {
    code: string;
    message: string;
}[];
/** Mirrors `cae-guidance-preview` evaluation context layering. */
export declare function buildPreviewEvaluationContext(opts: {
    workspacePath: string;
    effective: Record<string, unknown>;
    commandName: string;
    moduleId?: string;
    taskId?: string;
    commandArgs?: Record<string, unknown>;
    argvSummary?: string;
    currentKitPhase: string;
}): CaeEvaluationContext;
/** Build overlay registry + synthesized draft activation + playbook artifact validated against CAE schemas. */
export declare function synthesizeDraftArtifactAndOverlay(params: {
    workspacePath: string;
    baseRegistry: CaeLoadedRegistry;
    draft: DraftGuidanceRuleInputV1;
    knownWorkflowNames: string[];
}): {
    ok: false;
    code: string;
    message: string;
    scopeBuild?: GuidanceScopeBuildResult;
} | {
    ok: true;
    overlay: CaeLoadedRegistry;
    scopeBuild: GuidanceScopeBuildResult;
};
export declare function buildGuidanceDraftImpactMatrix(params: {
    workspacePath: string;
    effective: Record<string, unknown>;
    baseRegistry: CaeLoadedRegistry;
    overlayRegistry: CaeLoadedRegistry;
    scopeBuild: GuidanceScopeBuildResult;
    draftFamily: DraftGuidanceRuleInputV1["family"];
    primary: PreviewPrimaryInput;
    currentKitPhase: string;
    evalMode: CaeEvaluateMode;
}): GuidanceDraftImpactV1;
