import { E as Emitter, C as Callback } from './emitter-l0W9gC1A.js'; import { Serializable } from './internals/serializable.js'; import { LazyPromise } from './internals/helpers/promise.js'; import './internals/types.js'; import './internals/helpers/guards.js'; /** * Copyright 2025 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ interface RunInstance { emitter: Emitter; } interface RunContextCallbacks { start: Callback; success: Callback; error: Callback; finish: Callback; } type GetRunContext = T extends RunInstance ? RunContext : never; type GetRunInstance = T extends RunInstance ? P : never; 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(fn: (context: GetRunContext) => void): this; protected before(): Promise; } 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; readonly 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, Run, RunContext, type RunContextCallbacks, type RunContextInput, type RunInstance };