"""Core pipeline primitives — registry, runners, RunResult.

Introduced in CP-4 (modality registry & StepRunner split). Future CPs
extend this package with WorkflowStep types (CP-6), GenerationReceipt
(CP-5), Take model (CP-7), and eval primitives (CP-9).

Public surface — callers import from `pipeline.core` directly:

    from recoil.pipeline.core import (
        get_runner, register_runner,
        RunResult, ModalityRunner,
        MODALITY_IMAGE_T2I, MODALITY_VIDEO_I2V,
        MODALITY_AUDIO_T2A, MODALITY_LIPSYNC_POST,
    )

Phase 6 EXTENDS this `__init__.py` to also re-export
`register_default_runners` from `pipeline.core.runners` — the runners
package does not exist yet at Phase 2 (this file's creation), so Phase 2
intentionally re-exports only the registry surface.
"""
from recoil.pipeline.core.registry import (
    RunResult,
    ModalityRunner,
    register_runner,
    register_runner_factory,
    get_runner,
    list_modalities,
    is_registered,
    MODALITY_IMAGE_T2I,
    MODALITY_VIDEO_I2V,
    MODALITY_AUDIO_T2A,
    MODALITY_LIPSYNC_POST,
    MODALITY_EVAL_IMAGE_V1,
    MODALITY_EVAL_VIDEO_V1,
    MODALITY_EVAL_AUDIO_V1,
)

__all__ = [
    "RunResult",
    "ModalityRunner",
    "register_runner",
    "register_runner_factory",
    "get_runner",
    "list_modalities",
    "is_registered",
    "MODALITY_IMAGE_T2I",
    "MODALITY_VIDEO_I2V",
    "MODALITY_AUDIO_T2A",
    "MODALITY_LIPSYNC_POST",
    "MODALITY_EVAL_IMAGE_V1",
    "MODALITY_EVAL_VIDEO_V1",
    "MODALITY_EVAL_AUDIO_V1",
    "register_default_runners",
]

# Canonical register_default_runners lives in pipeline.core.dispatch (CP-5).
# This module (pipeline.core) re-exports it as the canonical convenience path.
# The lapsed pipeline.core.runners re-export was removed in engine-fix Phase D Phase 8.
from recoil.pipeline.core.dispatch import dispatch, register_default_runners  # noqa: E402
from recoil.pipeline.core.dispatch_context import DispatchContext  # noqa: E402
from recoil.pipeline.core.receipts import GenerationReceipt  # noqa: E402

if "dispatch" not in __all__:
    __all__ += ["dispatch", "DispatchContext", "GenerationReceipt"]

# CP-6 — Workflow object model (added in CP-6 Phase 4; StepStatus added R1)
from recoil.pipeline.core.workflow import Workflow, WorkflowStep, StepStatus  # noqa: E402, F401

if "Workflow" not in __all__:
    __all__ += ["Workflow", "WorkflowStep", "StepStatus"]

# CP-7 — append to existing imports/__all__
from recoil.pipeline.core.take import Take, Beat, Scene, TakeStatus  # noqa: E402

if "Take" not in __all__:
    __all__ += ["Take", "Beat", "Scene", "TakeStatus"]

# CP-9 — Eval primitive (Phase 3)
from recoil.pipeline.core.eval import (  # noqa: E402
    EvalContext,
    EvalResult,
    EvalNode,
    PanelOfJudges,
    EvalRegistry,
    register_eval_node,
    get_eval_node,
    list_eval_nodes,
    is_eval_registered,
    attach_eval_hooks,
    SUPPORTED_AGGREGATIONS,
    OUTLIER_THRESHOLD,
)

if "EvalContext" not in __all__:
    __all__ += [
        "EvalContext",
        "EvalResult",
        "EvalNode",
        "PanelOfJudges",
        "EvalRegistry",
        "register_eval_node",
        "get_eval_node",
        "list_eval_nodes",
        "is_eval_registered",
        "attach_eval_hooks",
        "SUPPORTED_AGGREGATIONS",
        "OUTLIER_THRESHOLD",
    ]
