import type { ConstraintViolation } from '../constraint.ts'; /** * Fired on the {@link Engine} when a serialized checkpoint exceeds the * configured size threshold ({@link DEFAULT_CHECKPOINT_SIZE_WARNING_THRESHOLD}). * Read `e.sizeBytes` and `e.step` to identify the offending workflow step. * * @example * ```ts * import { Engine, CheckpointSizeWarningEvent } from '@lostgradient/weft'; * * const engine = new Engine({ checkpointSizeWarningThreshold: 32_000 }); * engine.addEventListener(CheckpointSizeWarningEvent.type, (event) => { * console.warn(event.workflowId, 'checkpoint at step', event.step, 'is', event.sizeBytes, 'bytes'); * }); * ``` */ export declare class CheckpointSizeWarningEvent extends Event { static readonly type: "checkpoint:size-warning"; readonly workflowId: string; readonly sizeBytes: number; readonly step: number; constructor(workflowId: string, sizeBytes: number, step: number); } /** * Fired on the {@link Engine} (in development mode) when the engine detects * a potentially non-deterministic value in the workflow state — such as a Date * object, a function, or a class instance. Read `e.message` and `e.fieldPaths` * to locate the offending fields. * * @example * ```ts * import { Engine, DevelopmentWarningEvent } from '@lostgradient/weft'; * * const engine = new Engine({ development: true }); * engine.addEventListener(DevelopmentWarningEvent.type, (event) => { * console.warn('[dev]', event.message, 'paths:', event.fieldPaths); * }); * ``` */ export declare class DevelopmentWarningEvent extends Event { static readonly type: "development:warning"; readonly workflowId: string; readonly message: string; readonly fieldPaths: string[]; constructor(workflowId: string, message: string, fieldPaths: string[]); } export declare class CleanupWarningEvent extends Event { static readonly type: "cleanup:warning"; readonly source: string; readonly error: Error; readonly workflowId: string | undefined; constructor(source: string, error: Error, workflowId?: string); } /** * Fired on the {@link Engine} when the engine measures its total storage * footprint during a retention sweep. Read `e.sizeBytes` to track storage * growth over time. * * @example * ```ts * import { Engine, StorageSizeReportedEvent } from '@lostgradient/weft'; * * const engine = new Engine(); * engine.addEventListener(StorageSizeReportedEvent.type, (event) => { * console.log('total storage:', event.sizeBytes, 'bytes'); * }); * ``` */ export declare class StorageSizeReportedEvent extends Event { static readonly type: "storage:size-reported"; readonly sizeBytes: number; constructor(sizeBytes: number); } /** Fired when a remote worker successfully registers with the server runtime. */ export declare class WorkerConnectedEvent extends Event { static readonly type: "worker:connected"; readonly workerId: string; readonly queue: string; readonly activities: readonly string[]; readonly concurrency: number; constructor(workerId: string, queue: string, activities: readonly string[], concurrency: number); } /** Fired when a registered remote worker is removed after disconnect handling. */ export declare class WorkerDisconnectedEvent extends Event { static readonly type: "worker:disconnected"; readonly workerId: string; readonly inFlightTaskCount: number; constructor(workerId: string, inFlightTaskCount: number); } /** * Fired on the {@link Engine} when a built-in alert metric breaches its * threshold. Read `e.metric`, `e.threshold`, `e.currentValue`, and * optionally `e.window` to understand which alert triggered. * * @example * ```ts * import { Engine, AlertFiredEvent } from '@lostgradient/weft'; * * const engine = new Engine(); * engine.addEventListener(AlertFiredEvent.type, (event) => { * console.warn('alert fired:', event.metric, 'current:', event.currentValue, 'threshold:', event.threshold); * }); * ``` */ export declare class AlertFiredEvent extends Event { static readonly type: "alert:fired"; readonly metric: string; readonly threshold: number; readonly currentValue: number; readonly window: string | undefined; constructor(metric: string, threshold: number, currentValue: number, window?: string); } /** * Fired on the {@link Engine} when a previously fired alert returns below its * threshold. Mirrors {@link AlertFiredEvent} — read `e.metric`, * `e.currentValue`, and `e.threshold` to confirm the recovery. * * @example * ```ts * import { Engine, AlertResolvedEvent } from '@lostgradient/weft'; * * const engine = new Engine(); * engine.addEventListener(AlertResolvedEvent.type, (event) => { * console.log('alert resolved:', event.metric, 'value back to', event.currentValue); * }); * ``` */ export declare class AlertResolvedEvent extends Event { static readonly type: "alert:resolved"; readonly metric: string; readonly threshold: number; readonly currentValue: number; readonly window: string | undefined; constructor(metric: string, threshold: number, currentValue: number, window?: string); } /** * Fired on the {@link Engine} when a domain constraint's `check` function * returns `false`. Read `e.constraintName`, `e.scope`, and `e.onViolation` * to identify which constraint fired and what action the engine took. * * @example * ```ts * import { Engine, ConstraintViolatedEvent } from '@lostgradient/weft'; * * const engine = new Engine(); * engine.addEventListener(ConstraintViolatedEvent.type, (event) => { * console.warn('constraint', event.constraintName, 'violated in', event.workflowId, * 'action:', event.onViolation); * }); * ``` */ export declare class ConstraintViolatedEvent extends Event { static readonly type: "constraint:violated"; readonly workflowId: string; readonly constraintName: string; readonly scope: string; readonly onViolation: ConstraintViolation; constructor(workflowId: string, constraintName: string, scope: string, onViolation: ConstraintViolation); }