import type { ResolvedInput } from './inputs.js'; import type { Alert, CompiledProgram } from './types.js'; import type { Value } from './values/index.js'; /** One alert the engine raised, for the host to deliver. */ export interface AlertFiring { /** The entry's stable name: the script's `id`, or one derived from the line. */ readonly key: string; readonly title: string; /** The message, evaluated on the bar that fired, or absent where it was. */ readonly message: Value; readonly bar: number; /** The bar's open time in milliseconds, or null when the host stated none. */ readonly time: number | null; } /** What one execution of a bar offers the watch. */ export interface AlertBar { readonly index: number; readonly time: number | null; readonly isRealtime: boolean; } /** * The watch for one program, with its declaration fields resolved. * * A title and a frequency are declaration fields, which a script may write with * an `input()`, and inputs are resolved once at load. So they are read here, * before bar 0, rather than per bar, as every other declaration the descriptor * is built from is. * * A field that holds no string at all is a program whose field was lost or hand * edited, and the frequency it falls back to is the safest of the three: at most * one alert for a bar. */ export declare function alertsFor(program: CompiledProgram, inputs: readonly ResolvedInput[]): Alerts; /** One entry's declaration fields, resolved against the settings at load. */ export interface AlertFields { readonly title: string; readonly frequency: string; } export declare class Alerts { private readonly declared; private readonly resolved; /** The last bar each entry fired on, by declaration order. */ private readonly lastBar; private readonly everFired; constructor(declared: readonly Alert[], resolved: readonly AlertFields[]); /** * Step 9 on a bar the engine decided: the alerts it raises, in order. * * `read` is the channel's published value for this bar. A condition that is * absent is not true, which is `language.md` 6.6's three-valued logic reaching * a surface: an alert under a guard that was absent during warmup does not * fire, and that is the most common reason a new alert looks dead. */ raise(bar: AlertBar, read: (channel: number) => Value): readonly AlertFiring[]; /** * The frequency rule, which nothing else in the program implies. * * Two engines that guessed would fire different numbers of alerts from one * program, so the compiler writes the effective value and this reads it. * `everyUpdate` is the one that needs no test here: it fires on every decided * execution of the bar, which is why it needs `meta.onUnconfirmed` true to * mean anything and is OS3009 without it. */ private allowed; } //# sourceMappingURL=alerts.d.ts.map