/**
 * Event Bus Types Module
 *
 * Type definitions for the agent event bus (pub/sub) system.
 * Agents publish lifecycle events (idle, busy, active, inactive),
 * and subscribers receive notifications when matching events occur.
 *
 * @module types/event-bus
 */
/**
 * Valid agent lifecycle event types
 */
export declare const EVENT_TYPES: readonly ["agent:status_changed", "agent:idle", "agent:idle_after_registration", "agent:idle_after_task", "agent:busy", "agent:active", "agent:inactive", "agent:context_warning", "agent:context_critical", "agent:oauth_url", "task:submitted", "task:accepted", "task:working", "task:input_required", "task:verification_requested", "task:completed", "task:failed", "task:cancelled", "task:assigned", "task:done", "task:verified", "task:blocked", "task:needs_clarification", "team:all_tasks_done", "task:done_by_worker", "task:rejected", "mission:review_due", "mission:stale", "mission:replanned", "request:created", "request:sla_breached", "workitem:queued", "hierarchy:escalation", "hierarchy:delegation", "hierarchy:report_up", "system:backend_restarted", "system:memory_pressure", "task:queued_too_long"];
/**
 * An agent lifecycle event type
 */
export type EventType = (typeof EVENT_TYPES)[number];
/**
 * Event priority levels used for subscriber filtering.
 * Critical events are delivered immediately; info events may be suppressed
 * or debounced for subscribers that opt into critical-only mode.
 */
export type EventPriority = 'critical' | 'info';
/**
 * Critical event types that the orchestrator MUST receive.
 * These indicate actionable state changes: task completions, failures,
 * agent crashes, context exhaustion, and escalations.
 */
export declare const CRITICAL_EVENT_TYPES: ReadonlySet<EventType>;
/**
 * Info event types that are noisy for the orchestrator terminal.
 * Repeated idle/busy toggles, minor status changes, and routine hierarchy
 * updates fall here. Subscribers can still opt-in via explicit subscription.
 */
export declare const INFO_EVENT_TYPES: ReadonlySet<EventType>;
/**
 * Check if an event type is critical (requires immediate delivery).
 *
 * @param eventType - The event type to check
 * @returns True if the event type is critical
 */
export declare function isCriticalEventType(eventType: EventType | string): boolean;
/**
 * Get the list of critical event types as an array (for subscription creation).
 *
 * @returns Array of critical EventType values
 */
export declare function getCriticalEventTypes(): EventType[];
/**
 * Fields that can trigger events when changed
 */
export type ChangedField = 'agentStatus' | 'workingStatus' | 'contextUsage' | 'oauthUrl' | 'taskStatus' | 'hierarchyAction';
/**
 * An agent lifecycle event published to the event bus
 */
export interface AgentEvent {
    /** Unique event ID */
    id: string;
    /** Type of event */
    type: EventType;
    /** ISO timestamp when event occurred */
    timestamp: string;
    /** Team ID where the change occurred */
    teamId: string;
    /** Human-readable team name */
    teamName: string;
    /** Team member ID */
    memberId: string;
    /** Human-readable member name */
    memberName: string;
    /** PTY session name of the agent */
    sessionName: string;
    /** Previous field value */
    previousValue: string;
    /** New field value */
    newValue: string;
    /** Which field changed to trigger this event */
    changedField: ChangedField;
    /** Task ID associated with this event (for task:* and hierarchy:* events) */
    taskId?: string;
    /** Hierarchy level of the member who triggered the event */
    hierarchyLevel?: number;
    /** Parent member ID of the member who triggered the event */
    parentMemberId?: string;
    /**
     * Source WorkItem id for `task:*` events the BRIDGE-1 service consumes.
     * Optional everywhere except inside the bridge handlers, which require
     * either this or `taskId` to resolve the source WI.
     */
    workItemId?: string;
    /**
     * Mission id for `mission:*` events. Required for mission events to be
     * actionable downstream; optional on task events where a mission link
     * exists incidentally (e.g. the source WI has `missionId`).
     */
    missionId?: string;
    /**
     * Request id for `request:*` events (INBOUND-1). Carries the Request the
     * SLA subscriber will key its `respond_to_user` WorkItem on. Optional for
     * other event types — never read outside the request handlers.
     */
    requestId?: string;
}
/**
 * Filter criteria for matching events to subscriptions
 */
export interface EventFilter {
    /** Match events for a specific session name */
    sessionName?: string;
    /** Match events for a specific team member ID */
    memberId?: string;
    /** Match events for a specific team ID */
    teamId?: string;
    /** Match events for a specific task ID (hierarchy task events) */
    taskId?: string;
    /** Match events at a specific hierarchy level (0=orc, 1=TL, 2=worker) */
    hierarchyLevel?: number;
    /** Match events from subordinates of a specific parent member */
    parentMemberId?: string;
}
/**
 * A stored event subscription
 */
export interface EventSubscription {
    /** Unique subscription ID */
    id: string;
    /** Event type(s) to subscribe to */
    eventType: EventType | EventType[];
    /** Filter criteria for matching events */
    filter: EventFilter;
    /** If true, subscription is removed after first match */
    oneShot: boolean;
    /** Session name of the subscriber (who receives notifications) */
    subscriberSession: string;
    /** ISO timestamp when subscription was created */
    createdAt: string;
    /** ISO timestamp when subscription expires (optional) */
    expiresAt?: string;
    /** Custom notification template with placeholders */
    messageTemplate?: string;
}
/**
 * Input for creating a new subscription
 */
export interface CreateSubscriptionInput {
    /** Event type(s) to subscribe to */
    eventType: EventType | EventType[];
    /** Filter criteria for matching events */
    filter: EventFilter;
    /** If true, subscription is removed after first match (default: true) */
    oneShot?: boolean;
    /** Time-to-live in minutes (default: 30) */
    ttlMinutes?: number;
    /** Session name of the subscriber */
    subscriberSession: string;
    /** Custom notification template with placeholders */
    messageTemplate?: string;
}
/**
 * Check if a value is a valid EventType
 *
 * @param value - Value to check
 * @returns True if value is a valid EventType
 */
export declare function isValidEventType(value: unknown): value is EventType;
/**
 * Check if an object is a valid CreateSubscriptionInput
 *
 * @param value - Value to check
 * @returns True if value is a valid CreateSubscriptionInput
 */
export declare function isValidCreateSubscriptionInput(value: unknown): value is CreateSubscriptionInput;
//# sourceMappingURL=event-bus.types.d.ts.map