/**
 * Unified event types for the gateway event store.
 *
 * EventCategory is a superset of ReliabilityCategory — it covers all gateway
 * activity (messages, tool calls, sessions, orchestrations, crashes, etc.).
 * The type is `string` so extensions and plugins can emit custom categories.
 *
 * @module
 */
/**
 * Well-known event categories. The store accepts any string, so plugins
 * and extensions can use custom categories.
 */
export type EventCategory = "cron" | "browser" | "timezone" | "general" | "auth" | "skill" | "agent" | "gateway" | "connection" | "message" | "tool" | "session" | "orchestration" | "template" | "channel" | "crash" | "system" | "debug.step" | "prompt.section";
/** Event severity levels. "info" is the common case for activity logging. */
export type EventSeverity = "critical" | "high" | "medium" | "low" | "info";
/** Persisted event record with auto-assigned local ID. */
export type EventRecord = {
    /** Auto-increment local SQLite ID (monotonic sync cursor). */
    id: number;
    /** Category string — typically an EventCategory but open-ended. */
    category: string;
    severity: EventSeverity;
    /** Dot-separated event name (e.g. "tool.call.success"). */
    event: string;
    /** Human-readable description. */
    message: string;
    /** Optional agent ID for agent-scoped events. */
    agentId?: string;
    /** Optional correlation ID for linking related events (orchestrationId, sessionKey, etc.). */
    correlationId?: string;
    /** Arbitrary JSON metadata. */
    metadata?: Record<string, unknown>;
    /** Event timestamp (epoch ms) — when the event occurred. */
    timestamp: number;
    /** Row insertion time (epoch ms). */
    createdAt: number;
};
/** What callers pass to emitEvent(). ID and createdAt are auto-assigned. */
export type EventInput = Omit<EventRecord, "id" | "createdAt">;
export type EventQueryOptions = {
    category?: string;
    severity?: EventSeverity;
    agentId?: string;
    correlationId?: string;
    /** Return events with timestamp >= since. */
    since?: number;
    /** Return events with timestamp <= until. */
    until?: number;
    /** SQL LIKE pattern on event name (e.g. "tool.call.%"). */
    eventPattern?: string;
    /** SQL LIKE pattern on message (full-text search). */
    search?: string;
    limit?: number;
    offset?: number;
};
export type EventSummary = {
    total: number;
    byCategory: Record<string, number>;
    bySeverity: Record<string, number>;
};
export type TimelineBucket = {
    /** Bucket start timestamp (epoch ms). */
    bucket: number;
    count: number;
};
export type EventStoreConfig = {
    /** Path to local SQLite database file. */
    localDbPath: string;
    /** Per-category retention in days. Use "_default" for unlisted categories. */
    retention: Record<string, number>;
    /** Emit warning when DB exceeds this size in MB. */
    sizeWarningMb: number;
};
