/** * Pure builders for the scanner-summary and runtime-lifecycle event-log events. Each returns a fully * built {@link EmittableEvent} (or `null` when the source yields nothing), so the runtime emits with a * single `logger.event` call. Bodies are deterministic narratives; every attribute is a safe scalar. * * The scanner-summary funnel selection is reused from {@link buildScannerSummary} * — no reimplementation of the drop classification. */ import { EVENT_NAME } from "../utils/event-catalog.js"; import type { EmittableEvent } from "../actions/event-derivation.js"; /** * `scanner.summary` from the same scanner-run payload the scanner-complete handler emits. * `null` when the scan considered no candidates (the anti-spam grain). * Dropped candidates are market data → safe count attributes (`dropped_count` + by-reason), never * `redact`. */ export declare function buildScannerSummaryEvent(payload: unknown, nowMs: number): EmittableEvent | null; export interface RuntimeStartedInput { /** Strategy wallet — stamped so out-of-flow lifecycle events route to the per-strategy event store. */ readonly address?: string; /** Deployment/installation group (config top-level `group`) — the title-chain join key exposed as `runtimeGroupName`. */ readonly group?: string; readonly recipeName?: string; readonly recipeVersion?: string | number; readonly runtimeVersion?: string; readonly scannerCount: number; readonly actionCount: number; readonly hasDsl: boolean; /** Raw, pre-env-resolution config — the form the `senpi.config.hash` is computed over. */ readonly unresolvedConfig?: Record; /** Resolved sizing/leverage preset — low-cardinality scalars surfaced so the loaded values are visible. */ readonly slots?: number; readonly tradingRisk?: string; readonly marginPerSlot?: number; readonly marginPct?: number; readonly defaultLeverage?: number; } /** * `runtime.started` — carries the UNRESOLVED config hash (the form the recording identity hashes), so * the printed hash matches `senpi.config.hash` on the rows. Emitted at every `Runtime.start()`. */ export declare function buildRuntimeStartedEvent(input: RuntimeStartedInput): EmittableEvent; /** `runtime.stopped` — clean shutdown, with uptime. */ export declare function buildRuntimeStoppedEvent(runtimeVersion: string | undefined, uptimeMs: number, address?: string, group?: string): EmittableEvent; export interface RuntimeCreatedInput { readonly runtimeId: string; /** Strategy wallet — stamped so this out-of-flow registry event routes to the per-strategy store. */ readonly address?: string; readonly recipeName?: string; } /** * `runtime.created` — a runtime added to the registry via `senpi.installRuntime`. The create fact, * distinct from `runtime.started` (which also fires on a transient restart). */ export declare function buildRuntimeCreatedEvent(input: RuntimeCreatedInput): EmittableEvent; export interface RuntimeDeletedInput { readonly runtimeId: string; /** Strategy wallet — stamped so this out-of-flow registry event routes to the per-strategy store. */ readonly address?: string; /** Whether a running handle was stopped as part of the delete (vs a never-booted registration). */ readonly hadLiveHandle: boolean; } /** * `runtime.deleted` — a runtime removed from the registry via `senpi.deleteRuntime`. The discriminator * a transient `runtime.stopped` can't provide; fires unconditionally so a never-booted runtime * (which emits no `runtime.stopped`) is still observable. */ export declare function buildRuntimeDeletedEvent(input: RuntimeDeletedInput): EmittableEvent; export interface RuntimeUpdatedInput { readonly runtimeId: string; readonly address?: string; /** Raw, pre-env-resolution config of the NEW recipe — hashed the same way `runtime.started` does. */ readonly unresolvedConfig?: Record; /** Raw, pre-env-resolution config of the recipe being replaced. */ readonly previousUnresolvedConfig?: Record; readonly exitPresetChanged: boolean; readonly openPositions: number; readonly slots?: number; } /** * `runtime.updated` — a running strategy was swapped onto a new recipe in place. * * The body leads with the fact that most often surprises the person reading it back: an exit change * does not reach positions that were already open, because each carries a snapshot of the preset it * was opened under. */ export declare function buildRuntimeUpdatedEvent(input: RuntimeUpdatedInput): EmittableEvent; /** `runtime.paused` — a risk gate tripped a running→paused transition. WARN. */ export declare function buildRuntimePausedEvent(gateId: string | undefined, gateName: string | undefined, reason: string | undefined, address?: string): EmittableEvent; /** `runtime.resumed` — a previously-tripped risk gate cleared, re-arming a paused→running transition. */ export declare function buildRuntimeResumedEvent(gateId: string | undefined, gateName: string | undefined, address?: string): EmittableEvent; export interface QueueBackpressureInput { readonly depth: number; readonly threshold: number; readonly scannerId?: string; /** Strategy wallet — stamped explicitly; this fires outside the per-signal identity context. */ readonly address?: string; /** Ids of the run whose enqueue crossed the threshold; absent when that run carried none. */ readonly tickId?: string; readonly correlationId?: string; } /** * `runtime.queue_backpressure` — the serial signal queue reached the backpressure threshold, so the * consumer is falling behind inflow. WARN; the caller fires it on the rising edge only. No free-text, * so no `redact`. */ export declare function buildQueueBackpressureEvent(input: QueueBackpressureInput): EmittableEvent; /** Ids of the run a runtime-level failure was processing; absent when that run carried none. */ export interface RuntimeErrorIds { readonly tickId?: string; readonly correlationId?: string; } /** `runtime.error` — an uncaught signal-processing error. ERROR; the message rides `redact`. */ export declare function buildRuntimeErrorEvent(phase: string, scannerId: string | undefined, message: string, ids?: RuntimeErrorIds): EmittableEvent; //# sourceMappingURL=lifecycle-events.d.ts.map