/** * Error codes surfaced by `useInvestigationThroughLens`. * * - `unavailable` — the Grafana Assistant plugin is not loaded (or too old to * provide the lens implementation). * - `no_report` — the investigation does not exist or has not produced a * report yet. * - `permission_denied` — the current user cannot read the investigation. * - `validation_failed` — the model output did not conform to the requested * JSON Schema (after one corrective retry). * - `llm_error` — the generation request itself failed (network, limits, or * provider errors). */ export type InvestigationLensErrorCode = 'unavailable' | 'no_report' | 'permission_denied' | 'validation_failed' | 'llm_error'; export interface InvestigationLensError { code: InvestigationLensErrorCode; /** Human-readable description, safe to show to users. */ message: string; } /** * Discriminated result state: `data` and `error` can never coexist. */ export type InvestigationLensState = { status: 'loading'; data?: undefined; error?: undefined; } | { status: 'success'; data: T; error?: undefined; } | { status: 'error'; data?: undefined; error: InvestigationLensError; }; export type UseInvestigationThroughLensResult = InvestigationLensState & { /** Regenerates the view, bypassing the cached result for this schema + report. */ refresh: () => void; }; export interface UseInvestigationThroughLensOptions { /** * Attribution for the generation, e.g. `'grafana-irm/incident-detail'`. * Follows the same convention as the inline assistant's `origin`: the first * path segment identifies the integration. */ origin: string; /** * When false, the hook stays in the `loading` state and does not generate. * Useful to defer generation until a precondition is met (e.g. the * investigation has finished streaming its report). * * @default true */ enabled?: boolean; /** * When true, the generation triggered by `enabled` transitioning from false * to true bypasses cached results (one-shot, like `refresh()`). Set this * when the underlying report may have changed while the hook was disabled — * e.g. `enabled` gates on the report streaming, so caches primed before the * stream settled would otherwise serve a summary of the old report. First * mounts with `enabled: true` use the normal cached path. * * @default false */ refreshOnEnable?: boolean; } //# sourceMappingURL=types.d.ts.map