import type { EcoComponent } from '../../../types/public-types.js'; /** * Result returned by a renderer-owned foreign-child runtime. * * `inline` keeps rendering inside the current integration. `resolved.value` is * the queue transport token string allocated by `createQueuedRuntime`; callers * must not treat arbitrary objects as resolved output. */ export type ForeignChildInterceptionResult = { kind: 'inline'; props?: Record; } | { kind: 'resolved'; value: string; } | undefined; /** * Foreign-child metadata passed into the active renderer-owned runtime. */ export type ForeignChildInterceptionInput = { currentIntegration: string; targetIntegration?: string; component: EcoComponent; props: Record; }; /** * Narrow renderer-owned foreign-child runtime injected into one active render * context. * * Integrations implement this contract when foreign children must be handed * off inside the renderer instead of being left for route-level reconciliation. */ export interface ForeignChildRuntime { /** * Intercepts one foreign child during an active render. * * This runtime is typically installed by the Foreign Subtree execution module, * which decides whether the child stays inline or leaves the current renderer. */ interceptForeignChild?(input: ForeignChildInterceptionInput): ForeignChildInterceptionResult | Promise; interceptForeignChildSync?(input: ForeignChildInterceptionInput): Exclude; } type ForeignChildRenderInput = { component: EcoComponent; props: Record; targetIntegration?: string; }; /** * Per-render mutable state used while applying foreign-child interception and lazy * output wrapping. */ export type ComponentRenderContext = { currentIntegration: string; foreignChildRuntime?: ForeignChildRuntime; interceptForeignChild(input: ForeignChildRenderInput): Promise | ForeignChildInterceptionResult; finalizeComponentRender(component: EcoComponent, content: T): T; }; /** * Returns the current component render context, if one is active. * * @returns Active render context or `undefined` outside render execution. */ export declare function getComponentRenderContext(): ComponentRenderContext | undefined; /** * Runs foreign-child interception for one component render step. * * The active runtime may resolve the foreign child immediately or keep it inline. */ export declare function interceptForeignChild(input: ForeignChildRenderInput): Promise | ForeignChildInterceptionResult; /** * Applies lazy trigger or injector wrapping to completed component output. * * This helper works both inside render-context execution and in fallback flows * where no active context exists. */ export declare function finalizeComponentRender(component: EcoComponent, content: T): T; /** * Runs render work under a fresh component render context and returns the * resulting value. * * @param input Execution metadata for current integration and foreign-child policy. * @param render Async render function to execute inside the context. * @returns Render result value. */ export declare function runWithComponentRenderContext(input: { currentIntegration: string; foreignChildRuntime?: ForeignChildRuntime; }, render: () => Promise): Promise<{ value: T; }>; export {};