import { BlockDefinition, ComponentRegistryEntry } from "@ministryofjustice/hmpps-forge/core/components"; import { BaseFunctionRegistry, FunctionEvaluator, FunctionImplementations, FunctionRegistryEntry, FunctionRegistryObject, FunctionShapeMap, RegisteredForgePackage, UnreachableRedirectTarget } from "@ministryofjustice/hmpps-forge/core/authoring"; import { CookieOptions, ForgeOutcome, ForgeRenderer, ForgeTopology, Logger, NodeId, NodeId as NodeId$1, RenderBlock, RequestLocation, RequestSnapshot, ResponseBindings } from "@ministryofjustice/hmpps-forge/core/framework"; //#region forge-core/src/engine/chassis/registries/ComponentRegistry.d.ts /** * Registry for managing UI components in forge. * Components are stored by their variant name and can be retrieved during form rendering. */ declare class ComponentRegistry { private readonly components; /** * Register multiple components at once * @param components - Array of components to register * @throws ForgeRegistryDuplicateError if a component with the same variant already exists * @throws ForgeRegistryValidationError if a component is invalid * @throws AggregateError if multiple validation errors occur */ registerMany(components: ComponentRegistryEntry[]): void; /** * Get a component by variant * @param variant - The variant of the component to retrieve * @returns The component or undefined if not found */ get(variant: string): ComponentRegistryEntry | undefined; /** * Check if a component is registered * @param variant - The variant of the component to check * @returns True if the component exists, false otherwise */ has(variant: string): boolean; /** * Get all registered components * @returns Map of all registered components */ getAll(): Map>; /** * Get the count of registered components * @returns Number of registered components */ size(): number; } //#endregion //#region forge-core/src/engine/chassis/registries/FunctionRegistry.d.ts /** * Registry for managing functions (conditions, transformers, effects) in forge. * Functions are stored by their unique names and can be retrieved during form evaluation. */ declare class FunctionRegistry { private readonly functions; /** * Register functions - accepts either an array of functions or a registry object * @param input - Registry object created by the authoring function helpers * @throws ForgeRegistryDuplicateError if a function with the same name already exists * @throws ForgeRegistryValidationError if a function has invalid structure * @throws AggregateError if multiple validation errors occur */ register(input: FunctionRegistryObject): void; /** * Get a function by name * @param name - The name of the function to retrieve * @returns The function spec or undefined if not found */ get(name: string): FunctionRegistryEntry | undefined; /** * Check if a function is registered * @param name - The name of the function to check * @returns True if the function exists, false otherwise */ has(name: string): boolean; /** * Get all registered functions * @returns Map of all registered functions */ getAll(): Map; /** * Get the count of registered functions * @returns Number of registered functions */ size(): number; } //#endregion //#region forge-core/src/engine/chassis/contracts/ast/engine.type.d.ts interface ForgeDependencies { logger: Logger | Console; } /** @deprecated Use BaseFunctionRegistry subclasses instead */ type ForgeFunctionImplementations = Record FunctionEvaluator>; type ForgePackageFunctions = FunctionImplementations | BaseFunctionRegistry | BaseFunctionRegistry[]; /** * A package accepted by `Forge.registerPackage()`: the branded output of * `createForgePackage()`. Raw package literals are rejected at registration. */ type ForgePackageRegistration> = RegisteredForgePackage; //#endregion //#region forge-core/src/engine/concerns/reachability/contracts/journeyReachabilityProjection.type.d.ts interface StepReachabilityProjection { path: string; code?: string; fieldCodes?: string[]; cleardownFieldCodes?: string[]; backPath?: string; } interface JourneyReachabilityProjection { reachableSteps: StepReachabilityProjection[]; unreachableSteps: StepReachabilityProjection[]; } //#endregion //#region forge-core/src/engine/concerns/reachability/contracts/reachabilityEvaluation.type.d.ts type ResumeOutcome = 'no-op' | 'redirect'; //#endregion //#region forge-core/src/engine/chassis/contracts/runtime/answerHistory.type.d.ts /** * Hook types that can set answers. */ type HookType = 'access' | 'submit'; /** * Sources that can provide answer values. */ type AnswerSource = HookType | 'post' | 'processed' | 'default' | 'dependentWhen' | 'cleardown'; /** * A single answer mutation recorded by compiled answer prep and hook code. */ interface AnswerMutation { readonly value: unknown; readonly source: AnswerSource; } /** * History of mutations to an answer over the request lifecycle. */ interface AnswerHistory { current: unknown; parsed?: unknown; mutations: AnswerMutation[]; } //#endregion //#region forge-core/src/engine/concerns/validation/contracts/validationResult.type.d.ts interface ValidationResult { passed: boolean; message: string; submissionOnly: boolean; groups: string[]; details?: Record; blockCode?: string; } //#endregion //#region forge-core/src/engine/chassis/contracts/runtime/iteratorBudget.type.d.ts interface IteratorBudgetContract { consume(): void; } //#endregion //#region forge-core/src/engine/chassis/contracts/runtime/evaluationState.type.d.ts interface StepValidationFailure extends ValidationResult { blockId: NodeId$1; } type DomainValidationFailure = ValidationResult; interface RequestContextState { url: string; path: string; method: string; location: RequestLocation; headers: Record; cookies: Record; state: Record; params: Record; query: Record; post: Record; session: Record; } interface DomainContextState { data: Record; answers: Record; } interface EvaluationContextState { iteratorBudget?: IteratorBudgetContract; reachabilityValidities?: Map; reachability?: JourneyReachabilityProjection; fieldsToClear?: readonly string[]; } interface RuntimeContext { request: RequestContextState; domain: DomainContextState; evaluation: EvaluationContextState; } //#endregion //#region forge-core/src/engine/concerns/validation/contracts/stepValidityResult.type.d.ts /** * A step's recorded failure set from one validation run — every selected rule that * failed, each tagged with its `submissionOnly` flag and `groups`. Rule selection * happens before execution, so validity is simply "no failures recorded". */ interface StepValidityResult { fieldFailures: StepValidationFailure[]; domainFailures: DomainValidationFailure[]; } //#endregion //#region forge-core/src/engine/chassis/tracing/traceSpan.type.d.ts type TraceSpanFields = Readonly>; interface TraceSpanExecutionSlice { readonly startedAtMs: number; readonly completedAtMs: number; } interface SerializedTraceSpan { readonly key: string; readonly kind: string; readonly beginFields: TraceSpanFields; readonly completeFields: TraceSpanFields; readonly completed: boolean; readonly startedAtMs: number; readonly completedAtMs?: number; readonly durationMs?: number; readonly selfDurationMs?: number; readonly executionSlices?: readonly TraceSpanExecutionSlice[]; readonly children: readonly SerializedTraceSpan[]; } //#endregion //#region forge-core/src/engine/chassis/contracts/runtime/trace.type.d.ts interface RuntimeContextSnapshotTrace { readonly key: string; readonly kind: 'context-snapshot'; readonly beginFields: TraceSpanFields; readonly completeFields: TraceSpanFields; readonly completed: true; readonly children: readonly []; readonly answers: Record; readonly data: Record; readonly reachabilityValidities?: Record; readonly reachability?: JourneyReachabilityProjection; } type RequestTraceUnit = SerializedTraceSpan | RuntimeContextSnapshotTrace; interface RequestTracePhase { readonly phase: string; readonly startedAtMs: number; readonly completedAtMs?: number; readonly durationMs?: number; readonly units: readonly RequestTraceUnit[]; } interface RequestTraceRedirect { readonly target: string; } interface RequestTraceError { readonly status?: number; readonly message: string; readonly stack?: string; } /** One step in the request's reachability graph, projected from the runtime `ReachabilityNode`. */ interface RequestTraceReachabilityStep { readonly stepId: NodeId; readonly routeTemplatePath: string; readonly code?: string; readonly declarationIndex: number; readonly isEntryPoint: boolean; readonly isConditionalEntry: boolean; readonly hasValidation: boolean; readonly isReachable: boolean; readonly isValid: boolean; readonly forwardRouteTemplatePaths: readonly string[]; readonly declaredForwardRouteTemplatePaths?: readonly string[]; readonly predecessorRouteTemplatePaths: readonly string[]; readonly tieBreakerPriority?: number; } /** The request's reachability graph, projected from the runtime `ReachabilityEvaluation`. */ interface RequestTraceReachability { readonly currentStepId?: NodeId; readonly steps: readonly RequestTraceReachabilityStep[]; readonly defaultEntryRouteTemplatePath?: string; readonly frontierRouteTemplatePath?: string; readonly canonicalPathRouteTemplatePaths: readonly string[]; readonly progressExists: boolean; readonly resumeActive: boolean; readonly resumeOutcome: ResumeOutcome; readonly unreachableRedirect: UnreachableRedirectTarget; } interface RequestTrace { readonly outcome: 'render' | 'redirect' | 'error'; readonly startedAtMs: number; readonly completedAtMs?: number; readonly durationMs?: number; readonly redirect?: RequestTraceRedirect; readonly error?: RequestTraceError; readonly reachability?: RequestTraceReachability; readonly phases: readonly RequestTracePhase[]; } interface RequestTraceRouteContext { readonly journeyCode: string; readonly journeyTitle?: string; readonly stepTitle?: string; readonly routeTemplatePath: string; } interface RequestTraceEvent { readonly snapshot: RequestSnapshot; readonly trace: RequestTrace; readonly route?: RequestTraceRouteContext; } //#endregion //#region forge-core/src/engine/chassis/contracts/compilation/trace.type.d.ts /** * One compilation phase (for example DSL validation or code generation), with * its timing and the trace spans recorded while it ran. */ interface CompilationTracePhase { readonly phase: string; readonly startedAtMs: number; readonly completedAtMs?: number; readonly durationMs?: number; readonly units: readonly SerializedTraceSpan[]; } /** * The failure that ended a compilation. Kept independent of the runtime request * error shape: compile errors have no HTTP status and diagnostics must not * depend on the contracts/runtime layer. */ interface CompilationTraceError { readonly message: string; readonly stack?: string; } /** * A full compilation trace: overall outcome and timing plus the per-phase * breakdown of the work that ran. */ interface CompilationTrace { readonly outcome: 'compiled' | 'error'; readonly startedAtMs: number; readonly completedAtMs?: number; readonly durationMs?: number; readonly error?: CompilationTraceError; readonly phases: readonly CompilationTracePhase[]; } /** * A compilation trace paired with the journey it describes. `journeyCode` is * undefined when compilation fails before the AST — and so the journey code — * is available. */ interface CompilationTraceEvent { readonly journeyCode?: string; readonly trace: CompilationTrace; } //#endregion //#region forge-core/src/engine/chassis/tracing/ForgeTraceSinkDispatcher.d.ts interface ForgeInstrumentationOptions { readonly sinks?: readonly ForgeInstrumentationSink[]; } interface ForgeInstrumentationSink { onRequestTrace(event: RequestTraceEvent): void; onCompilationTrace?(event: CompilationTraceEvent): void; /** * Per-request opt-in. When present, request tracing only runs when at least * one sink returns true for the request; sinks without it always want traces. * Decided once per request, and delivery is scoped to the accepting sinks. */ shouldTrace?(snapshot: RequestSnapshot): boolean; } interface ForgeInstrumentation { readonly enabled: boolean; /** * Resolves the sinks that want this request (shouldTrace, decided once at * request start) into an instrumentation view scoped to those sinks - its * `enabled` and `onRequestTrace` reflect only the accepting sinks. */ forRequest(snapshot: RequestSnapshot): ForgeInstrumentation; onRequestTrace(event: RequestTraceEvent): void; onCompilationTrace(event: CompilationTraceEvent): void; } //#endregion //#region forge-core/src/engine/Forge.d.ts interface ForgeExecutionRequest { readonly snapshot: RequestSnapshot; readonly responseBindings?: ResponseBindings; readonly renderer?: ForgeRenderer; } /** * @deprecated Build framework routers directly, for example `createExpressRouter(forge, options)`. */ interface ForgeRouterAdapter { build(forge: Forge): unknown; } interface ForgeOptions { /** Skip registering built-in functions (conditions, transformers, effects). Default: false */ disableBuiltInFunctions?: boolean; /** Skip registering built-in components (html, collection-block). Default: false */ disableBuiltInComponents?: boolean; /** Enable debug logging for compilation and evaluation. Default: false */ debug?: boolean; /** * When `true` (default), registration errors from `registerPackage()` * throw immediately — fail fast on invalid journey * definitions, schema errors, duplicate routes, or compilation failures. * * When `false`, registration errors are logged via the configured logger * and the application continues starting — the failing journey simply * won't be available at runtime. * * @default true */ strictRegistration?: boolean; /** Logger instance for forge output */ logger?: Logger | Console; /** * Base path prefix for all routes. * * When set, all routes will be mounted under this path automatically. * Navigation metadata and redirects will include this prefix. * * @example * ```typescript * const forge = new Forge({ basePath: '/forms' }) * app.use(createExpressRouter(forge, { nunjucksEnv })) // Routes at /forms/journey/step * ``` * * @default '' */ basePath?: string; instrumentation?: ForgeInstrumentationOptions; /** Maximum cumulative iterator iterations allowed during one request. Default: 10,000 */ maxIteratorIterations?: number; /** * @deprecated Build framework routers directly, for example `createExpressRouter(forge, options)`. */ frameworkAdapter?: ForgeRouterAdapter; } declare class Forge { private readonly options; private readonly functionRegistry; private readonly componentRegistry; private readonly dependencies; private readonly mountRegistry; private readonly instrumentation; private readonly requestPipeline; /** * Create a new Forge instance * Use this for package registration, component/function registries, and routing. * * @param constructorOptions - Configuration options for Forge * * @example * ```typescript * import { Forge } from '.' * import { createExpressRouter } from '@ministryofjustice/hmpps-forge/express-nunjucks' * import { govukComponents } from '@ministryofjustice/hmpps-forge/govuk-components' * * const forge = new Forge({ logger }) * .registerGlobalComponents(govukComponents(nunjucksEnv)) * .registerPackage(myPackage) * * app.use(createExpressRouter(forge, { nunjucksEnv })) * ``` */ constructor(constructorOptions: ForgeOptions); /** Add a component to the global registry, making it available to all journeys. */ registerGlobalComponent(component: ComponentRegistryEntry): this; /** Add components to the global registry, making them available to all journeys. */ registerGlobalComponents(components: ComponentRegistryEntry[]): this; /** Add functions to the global registry, making them available to all journeys. */ registerGlobalFunctions(functions: ForgePackageFunctions, deps?: TDeps): this; /** * Register a package (journey + custom functions + components) with optional dependencies. * * This is a convenience method that registers components, functions, and the journey * in the correct order. * * @param pkg - The package containing journey, functions, and optional components * @param deps - Dependencies required by the package's functions (optional for packages with no deps) * * @example * ```typescript * // Package with dependencies * forge.registerPackage(myPackage, { api: services.apiClient }) * * // Package without dependencies * forge.registerPackage(simplePackage) * * // Conditionally disabled package * forge.registerPackage(createForgePackage({ * enabled: config.featureFlags.myFormEnabled, * journey: myJourney, * })) * ``` */ registerPackage(pkg: ForgePackageRegistration, deps?: TDeps): this; private registerPackageInstance; private handleRegistrationError; /** * The routes exposed by the registered journeys, as plain data. * * Adapters consume this to register routes with their framework and to map an * incoming request back to a {@link RequestSnapshot.nodeId}. */ getTopology(): ForgeTopology; getDependencies(): ForgeDependencies; /** The configured logger. */ getLogger(): Logger | Console; getInstrumentation(): ForgeInstrumentation; /** * @deprecated Build framework routers directly, for example `createExpressRouter(forge, options)`. */ getRouter(): unknown; execute(request: ForgeExecutionRequest): Promise>; private toError; } //#endregion //#region forge-core/src/engine/chassis/runtime/context/EffectFunctionContext.d.ts /** * User-friendly context object provided to effect functions. * Wraps the request/evaluation state with a cleaner API. * * Provides access to: * - Answers (get, set, check, clear) with mutation history tracking * - Data (get, set) * - Request data (params, query, post, session, state) * - Response mutations (headers, cookies) * * The hookType parameter determines the source recorded when setting answers. * * @typeParam TData - Type for stored data (accessed via getData/setData) * @typeParam TAnswers - Type for form answers (accessed via getAnswer/setAnswer) * @typeParam TSession - Type for session object (accessed via getSession) * @typeParam TState - Type for request state (accessed via getState) * * @example * // Define your project/journey schemas * interface MyData { * assessmentUuid: string * goals: Goal[] * } * * interface MyAnswers { * goalDescription: string * targetDate: string * } * * interface MySession { * user: User * stepsCompleted: string[] * } * * // Create a typed context alias * type MyContext = EffectFunctionContext * * // Use in effects * const myEffect = (context: MyContext) => { * context.getData('assessmentUuid') // typed as string * context.getData('nonExistent') // compile error * } */ declare class EffectFunctionContext = Record, TAnswers extends Record = Record, TSession = unknown, TState extends Record = Record> { private readonly context; private readonly response; private readonly hookType; /** * Get a specific answer value by key */ getAnswer(key: K): TAnswers[K]; getAnswer(key: string): TValue; /** * Set a specific answer value * * Pushes a mutation to the answer's history with the current hookType as source. * This enables precedence logic and delta tracking via mutation history. */ setAnswer(key: K, value: TAnswers[K]): void; /** * Get all answers (current values only, without history) */ getAllAnswers(): TAnswers; /** * Get the full history for an answer * * Returns the complete mutation history including all sources that have set this answer. */ getAnswerHistory(key: K): AnswerHistory | undefined; /** * Get all answer histories * * Returns all answers with their full mutation history. * Useful for calculating custom deltas based on mutation sources. */ getAllAnswerHistories(): Record; /** * Check if an answer exists */ hasAnswer(key: K): boolean; /** * Remove a specific answer */ clearAnswer(key: K): void; /** * Get stored data by key */ getData(key: K): TData[K]; getData(key: string): TValue; /** * Store data in the context */ setData(key: K, value: TData[K]): void; /** * Get all stored data */ getAllData(): TData; /** * Get the full request URL * * @example * const url = new URL(ctx.getRequestUrl()) * * url.origin // 'https://example.com:3000' * url.pathname // '/forms/journey/step-one' * url.search // '?page=1&filter=active' * url.searchParams.get('page') // '1' * url.hash // '#section' */ getRequestUrl(): string; /** * Get a specific route parameter */ getRequestParam(key: string): string | undefined; /** * Get all route parameters */ getAllRequestParams(): Record; /** * Get a specific query parameter */ getQueryParam(key: string): string | string[] | undefined; /** * Get all query parameters */ getAllQueryParams(): Record; /** * Get raw POST data (before formatting) */ getPostData(key: string): TValue | undefined; /** * Get all raw POST data (before formatting) */ getAllPostData>(): TValue; /** * Get the session object */ getSession(): TSession | undefined; /** * Get a custom request state value by key */ getState(key: K): TState[K] | undefined; /** * Get all custom request state data */ getAllState(): TState; /** * Get a request header value */ getRequestHeader(name: string): string | string[] | undefined; /** * Get all request headers */ getAllRequestHeaders(): Record; /** * Get a request cookie value */ getRequestCookie(name: string): string | undefined; /** * Get all request cookies */ getAllRequestCookies(): Record; /** * Set a response header via the adapter-provided response bindings. * Setting the same header multiple times will overwrite the previous value. */ setResponseHeader(name: string, value: string): void; /** * Set a cookie via the adapter-provided response bindings. * To clear a cookie, use maxAge: 0. * * @example * // Set a cookie with options * context.setResponseCookie('preference', 'dark', { * maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days * httpOnly: true, * secure: true, * sameSite: 'lax', * }) * * // Clear a cookie * context.setResponseCookie('preference', '', { maxAge: 0 }) */ setResponseCookie(name: string, value: string, options?: CookieOptions): void; /** * Get the field codes the answer-cleardown phase resolved as stale: field codes on * unreachable steps plus answer keys matching their `cleardownFieldCodes` patterns. * The engine has already pushed a clearing `cleardown` mutation onto each of these * answers; use this list to drop them from your own store when persisting. Empty for * hooks that run before the cleardown phase (access hooks). */ getFieldsToClear(): string[]; } //#endregion //#region forge-core/src/engine/concerns/resolve/runtime/typeguards.d.ts declare function isRenderBlock(obj: unknown): obj is RenderBlock; //#endregion //#region forge-core/src/engine/concerns/render/contracts/renderBlock.brand.d.ts declare const RENDER_BLOCK_BRAND: symbol; //#endregion //#region forge-core/src/engine/errors/ForgeBaseError.d.ts interface ForgeErrorDiagnostics { /** Human-readable path through the journey DSL */ readonly formattedPath?: string; /** Author callsite captured where the offending node was defined */ readonly callsite?: { readonly stack?: string; }; } /** * Base class for every error the engine throws. Owns the diagnostic fields * shared across the family (`formattedPath`, `callsite`), stamps `name` from * the concrete class, and owns `stack` rendering: raw frames are captured once * at construction (with constructor frames trimmed) and the display string — * folded forge-internal frames, defined-at frames, diagnostics block — is * assembled lazily on first read, so errors that get caught and handled never * pay for formatting. The unfolded original stays reachable via the * non-enumerable `rawStack`, and `FORGE_FULL_STACK=1` renders every frame. */ declare abstract class ForgeBaseError extends Error { readonly formattedPath?: string; readonly callsite?: { readonly stack?: string; }; readonly rawStack: string | undefined; private readonly rawStackHolder; protected constructor(message: string, diagnostics?: ForgeErrorDiagnostics); /** ForgeInternalError opts out: when the engine itself is broken, the internals are the story. */ protected get foldsInternalStackFrames(): boolean; /** The stack string whose frames form the rendered body — subclasses may substitute a cause's stack. */ protected stackBodySource(): string | undefined; /** Definition-site frames rendered after the execution frames as `at [defined] ...` lines. */ protected definedAtStackFrames(): string[]; /** The `Forge diagnostics:` block appended after the frames, if the subclass carries one. */ protected formatDiagnosticsBlock(): string | undefined; private renderStack; private renderRawStack; } //#endregion //#region forge-core/src/engine/errors/ForgeAuthoringError.d.ts interface ForgeAuthoringErrorOptions { /** Human-readable error message */ message: string; /** Human-readable path through the journey DSL */ formattedPath?: string; /** Author callsite captured where the offending definition was written */ callsite?: { readonly stack?: string; }; } /** * The authoring API was misused in a way the schema never gets to see - * thrown while builders and DSL helpers are still assembling the definition. */ declare class ForgeAuthoringError extends ForgeBaseError { constructor(options: ForgeAuthoringErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeInternalError.d.ts /** * A state the engine should make impossible - thrown when an internal * consistency check fails. Reaching one is a bug in Forge, not an authoring * mistake. */ declare class ForgeInternalError extends ForgeBaseError { constructor(message: string); protected get foldsInternalStackFrames(): boolean; } //#endregion //#region forge-core/src/engine/errors/ForgeDuplicateRouteError.d.ts interface ForgeDuplicateRouteErrorOptions { /** The duplicate route path */ routePath: string; /** Optional additional message */ message?: string; } declare class ForgeDuplicateRouteError extends ForgeBaseError { readonly routePath: string; constructor(options: ForgeDuplicateRouteErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeCompilationError.d.ts interface ForgeCompilationErrorOptions { readonly phase: string; readonly cause: unknown; readonly nodeId?: string; readonly formattedPath?: string; readonly functionName?: string; readonly functionType?: string; } declare class ForgeCompilationError extends ForgeBaseError { readonly phase: string; readonly nodeId?: string; readonly functionName?: string; readonly functionType?: string; readonly cause: unknown; constructor(options: ForgeCompilationErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeReferenceScopeError.d.ts interface ForgeReferenceScopeErrorOptions { /** Human-readable error message */ message: string; /** Human-readable path through the journey DSL */ formattedPath: string; /** Author callsite captured where the offending node was defined */ callsite?: { readonly stack?: string; }; } declare class ForgeReferenceScopeError extends ForgeBaseError { constructor(options: ForgeReferenceScopeErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeSchemaError.d.ts interface ForgeSchemaErrorOptions { /** Human-readable error message */ message: string; /** Expected value type/format */ expected?: string; /** Human-readable path through the journey DSL */ formattedPath?: string; /** Captured author callsite for the offending node, when available */ callsite?: { readonly stack?: string; }; } declare class ForgeSchemaError extends ForgeBaseError { readonly expected?: string; constructor(options: ForgeSchemaErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeSerialisationError.d.ts interface ForgeSerialisationErrorOptions { type: string; /** Human-readable error message */ message?: string; /** Human-readable path through the journey DSL */ formattedPath?: string; /** Captured author callsite for the offending node, when available */ callsite?: { readonly stack?: string; }; } declare class ForgeSerialisationError extends ForgeBaseError { readonly type: string; constructor(options: ForgeSerialisationErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeRegistrationError.d.ts declare class ForgeRegistrationError extends ForgeBaseError { constructor(message: string); } //#endregion //#region forge-core/src/engine/errors/ForgeRuntimeEvaluationError.d.ts interface ForgeRuntimeEvaluationErrorOptions { readonly phase: string; readonly cause: unknown; readonly nodeId?: string; readonly formattedPath?: string; readonly functionName?: string; readonly functionType?: string; readonly definedAt?: string; } /** * Wraps a failure thrown while evaluating a compiled forge function. The * author's error stays pristine on `cause`; this wrapper renders the combined * story — the cause's author frames, folded forge frames, defined-at frames, * and the diagnostics block. `definedAt` holds the newline-joined defined-at * chain, innermost frame first. */ declare class ForgeRuntimeEvaluationError extends ForgeBaseError { readonly phase: string; /** Mirrored from the cause so host error middleware keeps reading the author's HTTP status */ readonly status?: number; readonly statusCode?: number; readonly nodeId?: string; readonly functionName?: string; readonly functionType?: string; readonly definedAt?: string; readonly cause: unknown; constructor(options: ForgeRuntimeEvaluationErrorOptions); protected stackBodySource(): string | undefined; protected definedAtStackFrames(): string[]; protected formatDiagnosticsBlock(): string; } //#endregion //#region forge-core/src/engine/errors/ForgeFunctionArityError.d.ts interface ForgeFunctionArityErrorOptions { /** Name of the function whose arity is wrong */ functionName: string; /** Type of the function (e.g. FunctionType.Condition) */ functionType: string; /** Human-readable description of the expected arity (e.g. "2", "at least 2", "between 1 and 3") */ expected: string; /** Number of arguments the author actually supplied */ received: number; /** Human-readable path through the journey DSL */ formattedPath?: string; /** Author callsite captured where the offending node was defined */ callsite?: { readonly stack?: string; }; } declare class ForgeFunctionArityError extends ForgeBaseError { readonly functionName: string; readonly functionType: string; readonly expected: string; readonly received: number; constructor(options: ForgeFunctionArityErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeInvalidNodeError.d.ts interface ForgeInvalidNodeErrorOptions { /** Specific validation failure message */ message: string; /** The invalid node */ node?: any; /** What was expected */ expected?: string; /** What was actually found */ actual?: string; /** Human-readable path through the journey DSL */ formattedPath?: string; /** Author callsite captured where the offending node was defined */ callsite?: { readonly stack?: string; }; } declare class ForgeInvalidNodeError extends ForgeBaseError { readonly node?: any; readonly expected?: string; readonly actual?: string; constructor(options: ForgeInvalidNodeErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeRegistryDuplicateError.d.ts interface ForgeRegistryDuplicateErrorOptions { /** Type of registry (function or component) */ registryType: 'function' | 'component'; /** Name or variant of the item being registered */ itemName: string; /** Optional additional message */ message?: string; } declare class ForgeRegistryDuplicateError extends ForgeBaseError { readonly registryType: 'function' | 'component'; readonly itemName: string; constructor(options: ForgeRegistryDuplicateErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeRegistryValidationError.d.ts interface ForgeRegistryValidationErrorOptions { /** Type of registry (function or component) */ registryType: 'function' | 'component'; /** Name or variant of the item (if available) */ itemName?: string; /** What was expected */ expected: string; /** What was actually received */ received?: string; /** Human-readable error message */ message: string; } declare class ForgeRegistryValidationError extends ForgeBaseError { readonly registryType: 'function' | 'component'; readonly itemName?: string; readonly expected: string; readonly received?: string; constructor(options: ForgeRegistryValidationErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeUnknownNodeTypeError.d.ts interface ForgeUnknownNodeTypeErrorOptions { /** The unknown type encountered */ nodeType?: string; /** The actual node object */ node?: any; /** List of valid types (for helpful error messages) */ validTypes?: string[]; /** Human-readable path through the journey DSL */ formattedPath?: string; /** Author callsite captured where the offending node was defined */ callsite?: { readonly stack?: string; }; } declare class ForgeUnknownNodeTypeError extends ForgeBaseError { readonly nodeType?: string; readonly node?: any; readonly validTypes?: string[]; constructor(options: ForgeUnknownNodeTypeErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeUnregisteredComponentError.d.ts interface ForgeUnregisteredComponentErrorOptions { /** Variant name of the unregistered component */ variant: string; /** Human-readable path through the journey DSL */ formattedPath?: string; /** Author callsite captured where the offending node was defined */ callsite?: { readonly stack?: string; }; } declare class ForgeUnregisteredComponentError extends ForgeBaseError { readonly variant: string; constructor(options: ForgeUnregisteredComponentErrorOptions); } //#endregion //#region forge-core/src/engine/errors/ForgeUnregisteredFunctionError.d.ts interface ForgeUnregisteredFunctionErrorOptions { /** Name of the unregistered function */ functionName: string; /** Type of the function (e.g. FunctionType.Effect) */ functionType: string; /** Human-readable path through the journey DSL */ formattedPath?: string; /** Author callsite captured where the offending node was defined */ callsite?: { readonly stack?: string; }; } declare class ForgeUnregisteredFunctionError extends ForgeBaseError { readonly functionName: string; readonly functionType: string; constructor(options: ForgeUnregisteredFunctionErrorOptions); } //#endregion export { type CompilationTrace, type CompilationTraceError, type CompilationTraceEvent, type CompilationTracePhase, ComponentRegistry, EffectFunctionContext, Forge, ForgeAuthoringError, ForgeBaseError, ForgeCompilationError, ForgeDuplicateRouteError, type ForgeExecutionRequest, ForgeFunctionArityError, type ForgeFunctionImplementations, type ForgeInstrumentation, type ForgeInstrumentationOptions, type ForgeInstrumentationSink, ForgeInternalError, ForgeInvalidNodeError, type ForgeOptions, type ForgePackageFunctions, type ForgePackageRegistration, ForgeReferenceScopeError, ForgeRegistrationError, ForgeRegistryDuplicateError, ForgeRegistryValidationError, type ForgeRouterAdapter, ForgeRuntimeEvaluationError, ForgeSchemaError, ForgeSerialisationError, ForgeUnknownNodeTypeError, ForgeUnregisteredComponentError, ForgeUnregisteredFunctionError, FunctionRegistry, type HookType, RENDER_BLOCK_BRAND, type RequestTrace, type RequestTraceError, type RequestTraceEvent, type RequestTracePhase, type RequestTraceReachability, type RequestTraceReachabilityStep, type RequestTraceRedirect, type RequestTraceRouteContext, type RequestTraceUnit, type RuntimeContext, type SerializedTraceSpan, type ValidationResult, isRenderBlock };