import WarpError from "./errors/WarpError.js";
import { openWarpCoreRuntimeProduct, } from "./warp/WarpCoreRuntimeProduct.js";
/**
 * Full plumbing-facing WARP surface.
 *
 * `WarpCore` is the honest substrate/tooling entrypoint for replay,
 * materialization, provenance, comparison, and other low-level mechanics.
 * It now adopts an explicit structural core product rather than linking
 * itself onto the `WarpRuntime` prototype.
 *
 * @deprecated For application workflows, use openWarpWorldline(). WarpCore
 * remains supported for substrate tooling, diagnostics, replay, and
 * compatibility with existing graph-first integrations.
 */
export default class WarpCore {
    static async open(options) {
        return WarpCore._adopt(await openWarpCoreRuntimeProduct(options));
    }
    /**
     * Adopts an explicit structural core surface as a WarpCore instance.
     */
    static _adopt(surface) {
        if (surface instanceof WarpCore) {
            return surface;
        }
        Object.setPrototypeOf(surface, WarpCore.prototype);
        if (surface instanceof WarpCore) {
            return Object.freeze(surface);
        }
        throw new WarpError('failed to adopt runtime as WarpCore', 'E_WARP_CORE_ADOPT');
    }
    get effectPipeline() {
        return this._effectPipeline;
    }
    set effectPipeline(pipeline) {
        this._effectPipeline = pipeline;
    }
    get effectEmissions() {
        return this._effectPipeline ? this._effectPipeline.emissions : [];
    }
    get deliveryObservations() {
        return this._effectPipeline ? this._effectPipeline.observations : [];
    }
    get externalizationPolicy() {
        return this._effectPipeline ? this._effectPipeline.lens : null;
    }
    set externalizationPolicy(newLens) {
        if (this._effectPipeline) {
            this._effectPipeline.lens = newLens;
        }
    }
}
