/** * Queue-health threshold configuration domain: per-project age buckets for the * Factory Overview queue-health chart. * * Stored per `(org, github_project)` — each connected GitHub project gets its * own age thresholds so a fast-moving automated pipeline and a slow human one * can bucket "how old is the work" differently. `thresholdsSeconds` is an * ordered-ascending list of age boundaries in seconds: an item younger than * the first boundary is green, younger than the second amber, younger than the * third orange, and red otherwise. Seconds (not hours) so sub-minute buckets * are representable for fast automated flows. */ import { FactoryStorageDomain } from '@mastra/core/storage'; import type { CollectionSchema } from '@mastra/core/storage'; export interface QueueHealthConfig { /** Ordered-ascending age boundaries in seconds, e.g. `[14400, 86400, 259200]`. */ thresholdsSeconds: number[]; } /** Default: green <4h, amber <24h, orange <72h, red 72h+. */ export declare const DEFAULT_QUEUE_HEALTH_CONFIG: QueueHealthConfig; /** * Throw unless `thresholdsSeconds` is a non-empty ascending number list. A * descending config would silently invert bucket semantics, so validate at the * write boundary rather than trusting callers. */ export declare function assertValidThresholds(config: QueueHealthConfig): void; /** Validate untrusted JSON into a `QueueHealthConfig`, or `null` when invalid. */ export declare function parseQueueHealthConfig(body: unknown): QueueHealthConfig | null; /** * Return `config.thresholdsSeconds` when valid, else the default. Validation * lives at the `saveConfig` write boundary, but `getConfig` round-trips a * stored JSON row — a corrupted or hand-edited row (empty / non-ascending) * would otherwise reach the chart and invert bucket colors, so the read route * re-validates and falls back. */ export declare function thresholdsOrDefault(config: QueueHealthConfig): number[]; export declare const QUEUE_HEALTH_SETTINGS_SCHEMA: CollectionSchema; /** * Queue-health settings storage, written once against the generic * `FactoryStorageOps` surface — works on any `FactoryStorage` backend. */ export declare class QueueHealthStorage extends FactoryStorageDomain { #private; constructor(); init(): Promise; dangerouslyClearAll(): Promise; /** Read the project's queue-health config, falling back to {@link DEFAULT_QUEUE_HEALTH_CONFIG}. */ getConfig(orgId: string, factoryProjectId: string): Promise; /** Upsert the project's queue-health config (`created_at` is preserved on update). */ saveConfig(orgId: string, factoryProjectId: string, config: QueueHealthConfig): Promise; } //# sourceMappingURL=base.d.ts.map