/**
 * Port: Where task definitions come from.
 *
 * Adapters:
 * - ContentLakeTaskSource — GROQ query against Sanity Content Lake
 * - RepoTaskSource — reads .ailf/tasks/*.task.ts files
 * - TsTaskFileLoader — reads tasks/{mode}/*.task.ts (eval package)
 *
 * The key invariant: the pipeline orchestrator and all downstream steps
 * work with GeneralizedTaskDefinition[] regardless of where they came from.
 */
import type { GeneralizedAssertionDefinition, GeneralizedDocRef, GeneralizedTaskDefinition, GeneralizedTemplatedAssertion, IdDocRef, PathDocRef, PerspectiveDocRef, SlugDocRef } from "../types/generalized-task.js";
import type { FilterOptions, TaskPublishState } from "../types/index.js";
/** Check if a doc ref resolves by slug.
 *
 * Excludes IdDocRef (which may carry an optional `slug` for display).
 * When both `id` and `slug` are present, it's an IdDocRef, not a SlugDocRef.
 */
export declare function isSlugRef(ref: GeneralizedDocRef): ref is SlugDocRef;
/** Check if a doc ref resolves by path.
 *
 * Excludes IdDocRef (which may carry an optional `path` for display).
 * When both `id` and `path` are present, it's an IdDocRef, not a PathDocRef.
 */
export declare function isPathRef(ref: GeneralizedDocRef): ref is PathDocRef;
/** Check if a doc ref resolves by document ID.
 *
 * Uses `"id" in ref` as the primary discriminator. IdDocRef may also carry
 * optional `slug` and `path` for display purposes, so we cannot exclude
 * on those keys. When both `id` and `slug` are present, `id` wins.
 */
export declare function isIdRef(ref: GeneralizedDocRef): ref is IdDocRef;
/** Check if a doc ref resolves by content release perspective */
export declare function isPerspectiveRef(ref: GeneralizedDocRef): ref is PerspectiveDocRef;
/**
 * Extract a display identifier from any doc ref.
 * Useful for logging, error messages, and retrieval metrics.
 */
export declare function canonicalDocRefLabel(ref: GeneralizedDocRef): string;
/**
 * Resolve a canonical doc ref to its cross-version **document key** (D0084) —
 * the `baseDocumentId` of the logical document it names, anchor-relative.
 *
 * This is the single ref→document-identity resolver for the surfaces that join
 * a task's `context.docs` to the run's document manifest. It closes the
 * slug-bridge blind spot (`docs/design-docs/doctype-agnostic-eval.md`,
 * "Implementation correction"): an `IdDocRef` resolves on its `_id` directly,
 * so a slugless non-article pin is reachable, where a slug-only bridge dropped
 * it. Resolution strategy by ref kind:
 *
 * - **{@link IdDocRef}** → `baseDocumentId(ref.id)` directly. Type-agnostic, no
 *   slug needed. The informational `slug`/`path` annotations are ignored (they
 *   are author hints, never the manifest's actual slug — D-09).
 * - **{@link SlugDocRef}** → `slugToDocumentKey.get(ref.slug)`. The
 *   slug→document-key bridge is supplied by the caller (built from the manifest)
 *   because a bare editorial slug carries no id.
 * - **{@link PathDocRef}** → the last path segment (the editorial slug) through
 *   the same bridge.
 * - **{@link PerspectiveDocRef}** → `undefined`. A perspective ref expands
 *   one-to-many at fetch time; its document keys are unknown from the ref alone
 *   and are attributed separately via fetch-time expansion metadata.
 *
 * Returns `undefined` when an editorial handle was never resolved (typo'd /
 * out-of-corpus, so absent from the bridge) or for a perspective ref. The
 * returned key matches a manifest indexed by `baseDocumentId(documentId)`.
 *
 * Consolidation target: the other ref→identity extractors —
 * `extractDocumentKeysFromTask` (eval `fetch-docs-step.ts`, release auto-scope;
 * the freshly-written sibling, intentionally not migrated here),
 * `loadCanonicalDocs` (eval `retrieval-metrics.ts`, dormant), and
 * `extractInlineMappings` (eval `resolve-mappings.ts`, legacy) — each re-derive
 * this slug/id dispatch. Route them through this helper as they are touched so
 * the slug-only assumption cannot silently regrow.
 */
export declare function resolveDocRefToDocumentKey(ref: GeneralizedDocRef, slugToDocumentKey: ReadonlyMap<string, string>): string | undefined;
/** Check if an assertion uses the templated format (template + criteria) */
export declare function isTemplatedAssertion(entry: GeneralizedAssertionDefinition): entry is GeneralizedTemplatedAssertion;
/**
 * Port: Where task definitions come from.
 *
 * The pipeline never knows HOW tasks are loaded — it only sees
 * GeneralizedTaskDefinition[]. The adapter handles YAML parsing, GROQ
 * queries, filesystem scanning, etc.
 */
export interface TaskSource {
    /**
     * Load task definitions, optionally filtered by area/task.
     *
     * @param filter — Area, task ID, or changed-doc filters
     * @returns Validated task definitions ready for expansion
     */
    loadTasks(filter?: FilterOptions): Promise<GeneralizedTaskDefinition[]>;
}
/**
 * Optional capability: diagnose the publish state of specific task ids.
 *
 * Implemented by adapters whose backing store distinguishes published from
 * draft documents (today: `ContentLakeTaskSource`). The fast-fail validation
 * step uses this — *only after* `loadTasks` has already decided a task is
 * non-viable under the runner's published perspective — to classify *why*
 * (unpublished draft vs archived vs not-found) via a drafts-visible read.
 * It is deliberately separate from `loadTasks` so the viability decision and
 * the reason enrichment can't be conflated: the decision stays on the
 * published perspective; only the reason looks wider.
 */
export interface TaskViabilityProbe {
    /**
     * Return the publish-state signal for each requested task id. Ids with no
     * matching document map to `{ hasPublishedVersion: false, hasDraftVersion:
     * false }`.
     */
    probeTaskPublishState(taskIds: string[]): Promise<Map<string, TaskPublishState>>;
}
/** Narrow a `TaskSource` to one that also supports the viability probe. */
export declare function supportsViabilityProbe(source: TaskSource): source is TaskSource & TaskViabilityProbe;
