//! Extension trace capability — black-box evidence capture for lifecycle bugs.
//!
//! Trace is a sibling of `test` and `bench`: Homeboy resolves a component-owned
//! extension script, creates a run directory, passes an env-var contract, and
//! parses a JSON envelope written by the runner. Unlike bench, trace has no
//! baselines, ratchets, or metric gates; its job is to preserve causality and
//! evidence artifacts. Optional span baselines compare generic
//! `source.event` intervals without teaching core about product-specific
//! milestones.

pub mod assertions;
mod attach;
pub mod baseline;
mod overlay;
mod overlay_lock;
pub mod parsing;
pub mod probes;
pub mod report;
pub mod run;
pub mod spans;

use crate::core::component::Component;
use crate::core::extension::{ExtensionCapability, ExtensionExecutionContext};

pub use attach::TraceAttachment;
pub use overlay::TraceOverlayRequest;
pub use overlay_lock::{cleanup_stale_trace_overlay_locks, list_trace_overlay_locks};
pub use overlay_lock::{
    TraceOverlayLockCleanupResult, TraceOverlayLockRecord, TraceOverlayLockStatus,
};
pub use parsing::{parse_trace_list_str, parse_trace_results_file};
pub use parsing::{
    TraceArtifact, TraceAssertion, TraceEvent, TraceList, TraceScenario, TraceStatus,
};
pub use parsing::{TraceAssertionStatus, TraceResults, TraceSpanDefinition, TraceSpanResult};
pub use probes::{ActiveTraceProbes, TraceProbeConfig};
pub use report::{
    from_list_workflow, from_main_workflow, from_main_workflow_outputs, TraceAggregateOutput,
    TraceAggregateRunOutput, TraceAggregateSpanOutput, TraceClassificationSummaryOutput,
    TraceCommandOutput, TraceCompareClassificationSummaryOutput, TraceCompareOutput,
    TraceCompareSpanOutput, TraceGuardrailOutput, TraceOverlayLocksOutput,
    TraceRunOrderEntryOutput, TraceSpanMetadata, TraceVariantMatrixOutput,
    TraceVariantMatrixRunOutput,
};
pub use report::{push_overlay_markdown, render_markdown};
pub use run::{
    run_trace_list_workflow, run_trace_workflow, trace_is_unclaimed, TraceListWorkflowArgs,
};
pub use run::{TraceRunWorkflowArgs, TraceRunWorkflowResult, TraceRunnerInputs};

pub fn resolve_trace_command(
    component: &Component,
) -> crate::core::error::Result<ExtensionExecutionContext> {
    crate::core::extension::resolve_execution_context(component, ExtensionCapability::Trace)
}
