import { E as Emitter, C as Callback } from './emitter-D4OcelZ9.cjs'; import { Serializable } from './internals/serializable.cjs'; import { LazyPromise } from './internals/helpers/promise.cjs'; import { FrameworkError } from './errors.cjs'; import './internals/types.cjs'; import './internals/helpers/guards.cjs'; /** * Copyright 2025 © BeeAI a Series of LF Projects, LLC * SPDX-License-Identifier: Apache-2.0 */ interface RunInstance { emitter: Emitter; } interface RunContextCallbacks { start: Callback<{ input: any; output: any; }>; success: Callback; error: Callback; finish: Callback<{ input: any; output?: any; error?: FrameworkError; }>; } declare abstract class Middleware { abstract bind(ctx: RunContext): void; } type GetRunContext = T extends RunInstance ? RunContext : never; type GetRunInstance = T extends RunInstance ? P : never; type MiddlewareFn = (context: GetRunContext) => void; type MiddlewareType = Middleware | MiddlewareFn; declare class Run extends LazyPromise { protected readonly runContext: GetRunContext; protected readonly tasks: (() => Promise)[]; constructor(handler: () => Promise, runContext: GetRunContext); readonly [Symbol.toStringTag] = "Promise"; observe(fn: (emitter: Emitter>) => void): this; context(value: object): this; middleware(...fns: MiddlewareType[]): this; protected before(): Promise; [Symbol.asyncIterator](): R extends AsyncIterable ? AsyncIterator : never; } interface RunContextInput

{ params: P; signal?: AbortSignal; } declare class RunContext extends Serializable { #private; readonly instance: T; protected readonly input: RunContextInput

; protected readonly controller: AbortController; readonly runId: string; readonly groupId: string; readonly parentId?: string; readonly emitter: Emitter>; readonly context: object; runParams: P; readonly createdAt: Date; get signal(): AbortSignal; abort(reason?: Error): void; constructor(instance: T, input: RunContextInput

, parent?: RunContext); destroy(): void; static enter(instance: C2, input: RunContextInput, fn: (context: GetRunContext) => Promise): Run; createSnapshot(): { controller: AbortController; runId: string; groupId: string; parentId: string | undefined; emitter: Emitter>; context: object; runParams: P; createdAt: Date; }; loadSnapshot(snapshot: ReturnType): void; } export { type GetRunContext, type GetRunInstance, Middleware, type MiddlewareFn, type MiddlewareType, Run, RunContext, type RunContextCallbacks, type RunContextInput, type RunInstance };