import { ActivityRegistry } from '../activity-registry.ts'; import { type ActivityDefinition, type QueryDefinition, type SignalDefinition, type UpdateDefinition, type WorkflowDefinition } from '../types.ts'; import type { RegistrationEntry } from './engine-internal-types.ts'; import type { EngineInternals } from './internals.ts'; export type RegistrationCallbacks = { ensureRetentionSweepInterval: () => void; dispatchEvent: (event: Event) => void; }; /** * Reject constraints on a workflow definition when the engine has no * inline execution strategy. Exported so `dynamic-source-execution.ts` * (WFT-15/16) can apply the identical guard to a dynamically-resolved * definition — see that module's own call site. */ export declare function assertConstraintsSupported(internals: EngineInternals, name: string, registration: WorkflowDefinition): void; /** * Build the `RegistrationEntry` `engine.register()` would store for * `registration`, without committing anything — pure normalization * (base fields, optional fields, and, for a builder-produced definition, * signal/update/query name-collision checks). Exported so the dynamic * workflow-source validation pipeline (`core/source/validate.ts`, WFT-13/14) * can normalize a loaded module's exported definition through the identical * path `engine.register()` uses, rather than re-deriving a * `RegistrationEntry` independently and risking the two producers drifting * apart. * * @example * ```ts * import { workflow } from '@lostgradient/weft'; * * const greet = workflow({ name: 'greet' }).execute(async function* (_ctx, input: string) { * return `hello ${input}`; * }); * console.log(greet.name); * ``` */ export declare function buildRegistrationEntry(name: string, registration: WorkflowDefinition): RegistrationEntry; /** * Visit every RESOLVED `registerSource()`-registered type's normalized * retention policy (via {@link buildRegistrationEntry}) — the dynamic-source * counterpart to walking `internals.registrations.values()` directly for an * eager type. Used by `bulk-operations-purge.ts` so a dynamic workflow's own * (possibly shorter) retention window narrows the purge sweep's scan bound * the same way an eager registration's does. */ export declare function forEachResolvedDynamicRetentionPolicy(internals: EngineInternals, visit: (policy: RegistrationEntry['retention']) => void): void; /** * True when at least one `registerSource()`-registered type has a * registered candidate revision this process has NOT yet resolved — its * retention policy (and everything else `buildRegistrationEntry` would * derive) is genuinely unknown, so `getMinimumRetentionMs()`'s scan-bound * optimization in `bulk-operations-purge.ts` cannot be trusted (WFT-19 * review round 1): it silently excluded exactly this class of workflow * from the periodic retention sweep's scan bound, since an unresolved * candidate's possibly-shorter-than-default retention window was invisible * to the minimum computation. Used to fall back to an unbounded terminal * scan while any such candidate remains unresolved — self-healing once * `shouldPurgeWorkflowState`'s own per-run resolve installs it. */ export declare function hasUnresolvedDynamicSourceCandidate(internals: EngineInternals): boolean; /** * Structural predicate for `BuiltWorkflowDefinition` — the runtime shape * `workflow({ name }).execute(...)` returns. Exported so the dynamic * workflow-source validation pipeline (`core/source/validate.ts`, WFT-13/14) * can reject a loaded export that is a hand-rolled `{ name, handler }` * literal rather than a builder-produced definition — the same "removed * bare-handler shape" rejection `engine.register()` itself applies via * {@link buildRegistrationEntry}. * * @example * ```ts * import { workflow } from '@lostgradient/weft'; * * const greet = workflow({ name: 'greet' }).execute(async function* (_ctx, input: string) { * return `hello ${input}`; * }); * console.log(typeof greet.activities === 'object'); * ``` */ export declare function isBuilderWorkflowDefinition(value: unknown): value is WorkflowDefinition & { readonly activities: Readonly>>; readonly signals: Readonly>>>; readonly updates: Readonly>>>; readonly queries: Readonly>>>; readonly searchAttributes: Readonly>; }; /** * Build a fresh per-workflow {@link ActivityRegistry} from a builder workflow's * activities map. Each entry is defensively deep-cloned and then turned into a * fresh `ActivityCallable` via {@link activity}, so the engine's registry holds * its own callable references and the user's `BuiltWorkflowDefinition` cannot * influence dispatch by post-registration mutation. * * Exported so the dynamic workflow-source validation pipeline * (`core/source/validate.ts`, WFT-13/14) can build the same * uncommitted-but-canonical per-workflow registry for a loaded module's * export that `engine.register()` builds for an eagerly registered one — * required so {@link import('../registry-workflow-manifest.ts').buildWorkflowManifestFromDefinition} * produces byte-identical manifests for the two paths. * * @example * ```ts * import { workflow } from '@lostgradient/weft'; * * const greet = workflow({ name: 'greet' }).execute(async function* (_ctx, input: string) { * return `hello ${input}`; * }); * console.log(Object.keys(greet.activities).length); * ``` */ export declare function buildPerWorkflowActivityRegistry(activities: Readonly>>): ActivityRegistry; export declare function register(internals: EngineInternals, definition: unknown, callbacks: RegistrationCallbacks): void; export declare function resolveWorkflowTypeTarget(internals: EngineInternals, target: string | Function, _callbacks: RegistrationCallbacks): string;