import type { JupiterOneClient } from '../../client/jupiterone-client.js'; import type { Query } from '../../types/jupiterone.js'; import { type LiteralDiagnosis } from './value-probe.js'; /** * What a widget will actually draw, reported alongside the created widget. * * A widget whose query returns no rows is created successfully and renders blank, with no error * anywhere in the flow (TD-9016). The column contract is checked before creation and blocks; row * emptiness cannot block, because an empty widget is often the right answer — "critical findings: * 0" is good news. So the server reports the fact and the agent judges the intent. */ export interface WidgetRenderPreflight { /** * `probed` means the queries were run and what follows is measured. It is NOT a certificate that * the widget is correct — nothing here inspects the renderer, and the data can change under a * correct widget. `skipped` means no query ran, and `reason` says why. */ status: 'probed' | 'skipped'; /** Why no query was run, when `status` is `skipped`. */ reason?: string; /** Rows returned across the widget's queries. Null when skipped. */ rowsReturned: number | null; /** * Wall-clock time this preflight took, including the value diagnosis. * * The telemetry event's `durationMs` covers the whole tool call, so since the preflight landed it * silently includes up to PREFLIGHT_WITH_DIAGNOSIS_BUDGET_MS of advisory work — the write path * looks slower with no way to say how much of that is the write. Reported on skipped outcomes * too: a skip is not free, and one that took ten seconds before giving up is worth seeing. */ preflightMs: number; /** True when the widget will draw nothing as configured. */ willRenderEmpty: boolean; /** * Required columns that are absent or null in every row returned. * * A query can return rows and still draw nothing: `RETURN avg(e.nonexistent) AS value` yields one * row with no keys at all, so a row count alone reports the widget as fine. This is the column * the chart actually reads coming back empty. */ emptyColumns?: string[]; /** Columns the chart type uses when present — absent here, so the chart renders degraded. */ missingRecommended?: string[]; /** * What the query's string literals turned out to mean against this account's data. * * Row counts alone cannot tell a correct widget from a confidently wrong one: a filter on one * casing of a value that is stored in three returns a plausible number and silently omits the * rest. Present only when a literal has something to say. */ diagnosis?: LiteralDiagnosis[]; /** One sentence for the caller to act on or relay. */ note?: string; } /** * Run a widget's queries and report what it will draw. * * Fails open on every error, including a timeout: this runs after the widget has already been * created, so advisory work must never turn a successful create into a failure. A skipped preflight * says so rather than claiming the widget is fine. */ export declare function runRenderPreflight(client: JupiterOneClient, chartType: string | undefined, queries: Query[] | undefined, noResultMessage: string | undefined): Promise; //# sourceMappingURL=widget-preflight.d.ts.map