/** * Pure builders for the DSL exit-engine's failure-state events — degradation the monitor tracks but * that previously surfaced only as a tick-span error or a `warn` log: an exchange SL push that threw * ({@link buildSlSyncFailedEvent}), a position with no price past the stale threshold * ({@link buildPriceFetchStaleEvent}), and a Phase-2 backend handoff that degraded * ({@link buildHandoffFailedEvent}). * * Pure `(input) => EmittableEvent`; the monitor emits the result through `emitEvent`'s guard, so a * throwing build or a telemetry failure can never disturb a tick. A thrown venue/backend error rides * the event's `error` slot (exception semconv + `recordException` on the active span); an opaque * declined-registration backend payload rides the `redact` slot. Identity (`senpi.strategy.*`) is * stamped at emit time from the tick's async-context bag, as for the sibling `dsl.*` transition * events, so it is not passed here. */ import { EVENT_NAME } from "../../utils/event-catalog.js"; import type { EmittableEvent } from "../../actions/event-derivation.js"; /** The position the failed tick was managing — the id/asset/dex every DSL failure event carries. */ export interface DslFailureContext { asset: string; /** Venue/dex; omitted → not stamped (a single-venue position). */ dex?: string; /** The cross-flow position id (`positionId ?? correlationId`); absent on a pre-id position. */ positionId?: string; /** The monitor tick that hit the failure; absent when no tick is behind the build. */ tickId?: string; } /** Which handoff step degraded — the discriminator on a `dsl.handoff_failed` event. */ export type HandoffFailure = "register" | "rollback" | "poll"; /** An exchange SL create/update (`editPosition`) threw — the stop the venue never received. */ export declare function buildSlSyncFailedEvent(ctx: DslFailureContext, failureCount: number, error: unknown): EmittableEvent; /** No market price for `failureCount` consecutive ticks — the position can't be evaluated. */ export declare function buildPriceFetchStaleEvent(ctx: DslFailureContext, failureCount: number): EmittableEvent; /** * A Phase-2 backend handoff degraded. `register` left the handoff stuck pending (the backend declined * or threw — a throw rides `error`); `rollback` reverted to local Phase 2 management (the backend lost * our stop); `poll` failed to reach the backend while it owns the stop (rides `error`). */ export declare function buildHandoffFailedEvent(ctx: DslFailureContext, opts: { failure: HandoffFailure; backendPositionId?: string; error?: unknown; redact?: Record; }): EmittableEvent; //# sourceMappingURL=dsl-failure-events.d.ts.map