/**
 * Orchestrator Message Types (TB-O14a)
 *
 * Defines typed message conventions for inter-agent communication.
 * These types extend the base Stoneforge messaging system with
 * orchestrator-specific semantics.
 *
 * Message types:
 * - task-assignment: New task has been assigned to an agent
 * - status-update: Progress update from an agent
 * - help-request: Agent requesting assistance
 * - handoff: Session handoff between agents
 * - health-check: Health monitoring ping
 *
 * @module
 */
import type { EntityId, ElementId, Timestamp } from '@stoneforge/core';
type TaskId = ElementId;
/**
 * Known message types for orchestrator inter-agent communication.
 */
export declare const MessageTypeValue: {
    readonly TASK_ASSIGNMENT: "task-assignment";
    readonly STATUS_UPDATE: "status-update";
    readonly HELP_REQUEST: "help-request";
    readonly HANDOFF: "handoff";
    readonly HEALTH_CHECK: "health-check";
    readonly GENERIC: "generic";
};
export type MessageTypeValue = (typeof MessageTypeValue)[keyof typeof MessageTypeValue];
/**
 * Array of all message type values for iteration
 */
export declare const AllMessageTypes: readonly MessageTypeValue[];
/**
 * Base interface for all orchestrator message metadata.
 */
export interface BaseMessageMeta {
    /** Message type identifier */
    readonly type: MessageTypeValue;
    /** Timestamp when message was created */
    readonly timestamp: Timestamp;
    /** Optional correlation ID for tracking related messages */
    readonly correlationId?: string;
}
/**
 * Message sent when a task is assigned to an agent.
 */
export interface TaskAssignmentMessage extends BaseMessageMeta {
    readonly type: 'task-assignment';
    /** The task being assigned */
    readonly taskId: TaskId;
    /** Task title for display */
    readonly taskTitle: string;
    /** Task priority */
    readonly priority?: number;
    /** Who assigned the task */
    readonly assignedBy?: EntityId;
    /** Git branch for the task (if applicable) */
    readonly branch?: string;
    /** Worktree path (if applicable) */
    readonly worktree?: string;
    /** Whether this is a reassignment */
    readonly isReassignment?: boolean;
    /** Previous assignee (if reassignment) */
    readonly previousAssignee?: EntityId;
}
/**
 * Validates a TaskAssignmentMessage
 */
export declare function isTaskAssignmentMessage(value: unknown): value is TaskAssignmentMessage;
/**
 * Creates a validated TaskAssignmentMessage
 */
export declare function createTaskAssignmentMessage(input: Omit<TaskAssignmentMessage, 'type' | 'timestamp'> & {
    timestamp?: Timestamp;
}): TaskAssignmentMessage;
/**
 * Status update severity levels
 */
export declare const StatusUpdateSeverity: {
    readonly INFO: "info";
    readonly WARNING: "warning";
    readonly ERROR: "error";
};
export type StatusUpdateSeverity = (typeof StatusUpdateSeverity)[keyof typeof StatusUpdateSeverity];
/**
 * Message sent to update status/progress.
 */
export interface StatusUpdateMessage extends BaseMessageMeta {
    readonly type: 'status-update';
    /** Agent sending the update */
    readonly agentId: EntityId;
    /** Status message text */
    readonly message: string;
    /** Severity level */
    readonly severity?: StatusUpdateSeverity;
    /** Related task (if applicable) */
    readonly taskId?: TaskId;
    /** Progress percentage (0-100) */
    readonly progress?: number;
    /** Current phase/step name */
    readonly phase?: string;
    /** Additional details */
    readonly details?: Record<string, unknown>;
}
/**
 * Validates a StatusUpdateMessage
 */
export declare function isStatusUpdateMessage(value: unknown): value is StatusUpdateMessage;
/**
 * Creates a validated StatusUpdateMessage
 */
export declare function createStatusUpdateMessage(input: Omit<StatusUpdateMessage, 'type' | 'timestamp'> & {
    timestamp?: Timestamp;
}): StatusUpdateMessage;
/**
 * Help request urgency levels
 */
export declare const HelpRequestUrgency: {
    readonly LOW: "low";
    readonly NORMAL: "normal";
    readonly HIGH: "high";
    readonly CRITICAL: "critical";
};
export type HelpRequestUrgency = (typeof HelpRequestUrgency)[keyof typeof HelpRequestUrgency];
/**
 * Message sent when an agent needs assistance.
 */
export interface HelpRequestMessage extends BaseMessageMeta {
    readonly type: 'help-request';
    /** Agent requesting help */
    readonly agentId: EntityId;
    /** Description of the problem */
    readonly problem: string;
    /** What the agent has already tried */
    readonly attemptedSolutions?: string[];
    /** Related task (if applicable) */
    readonly taskId?: TaskId;
    /** Urgency level */
    readonly urgency?: HelpRequestUrgency;
    /** Error message (if applicable) */
    readonly errorMessage?: string;
    /** Stack trace (if applicable) */
    readonly stackTrace?: string;
    /** Suggested next steps */
    readonly suggestedActions?: string[];
}
/**
 * Validates a HelpRequestMessage
 */
export declare function isHelpRequestMessage(value: unknown): value is HelpRequestMessage;
/**
 * Creates a validated HelpRequestMessage
 */
export declare function createHelpRequestMessage(input: Omit<HelpRequestMessage, 'type' | 'timestamp'> & {
    timestamp?: Timestamp;
}): HelpRequestMessage;
/**
 * Message sent for session handoff between agents.
 * This extends the HandoffContent from handoff.ts with message-specific fields.
 */
export interface HandoffMessage extends BaseMessageMeta {
    readonly type: 'handoff';
    /** Agent initiating the handoff */
    readonly fromAgent: EntityId;
    /** Target agent (undefined for self-handoff) */
    readonly toAgent?: EntityId;
    /** Task IDs being transferred */
    readonly taskIds: TaskId[];
    /** Summary of current context */
    readonly contextSummary: string;
    /** Recommended next steps */
    readonly nextSteps?: string;
    /** Reason for handoff */
    readonly reason?: string;
    /** Provider session ID for predecessor queries */
    readonly providerSessionId?: string;
    /** Reference to handoff document */
    readonly handoffDocumentId?: string;
    /** Whether this is a self-handoff */
    readonly isSelfHandoff: boolean;
}
/**
 * Validates a HandoffMessage
 */
export declare function isHandoffMessage(value: unknown): value is HandoffMessage;
/**
 * Creates a validated HandoffMessage
 */
export declare function createHandoffMessage(input: Omit<HandoffMessage, 'type' | 'timestamp' | 'isSelfHandoff'> & {
    timestamp?: Timestamp;
    isSelfHandoff?: boolean;
}): HandoffMessage;
/**
 * Health check result status
 */
export declare const HealthCheckStatus: {
    readonly HEALTHY: "healthy";
    readonly DEGRADED: "degraded";
    readonly UNHEALTHY: "unhealthy";
    readonly UNKNOWN: "unknown";
};
export type HealthCheckStatus = (typeof HealthCheckStatus)[keyof typeof HealthCheckStatus];
/**
 * Message sent for health monitoring.
 */
export interface HealthCheckMessage extends BaseMessageMeta {
    readonly type: 'health-check';
    /** Agent being checked (target) */
    readonly targetAgentId: EntityId;
    /** Agent performing the check (source) */
    readonly sourceAgentId: EntityId;
    /** Whether this is a request or response */
    readonly isResponse: boolean;
    /** Health status (for responses) */
    readonly status?: HealthCheckStatus;
    /** Last activity timestamp (for responses) */
    readonly lastActivityAt?: Timestamp;
    /** Current task being worked on (for responses) */
    readonly currentTaskId?: TaskId;
    /** Additional health metrics */
    readonly metrics?: {
        /** Memory usage percentage */
        memoryUsage?: number;
        /** CPU usage percentage */
        cpuUsage?: number;
        /** Time since last output in milliseconds */
        timeSinceLastOutput?: number;
        /** Number of errors in current session */
        errorCount?: number;
    };
}
/**
 * Validates a HealthCheckMessage
 */
export declare function isHealthCheckMessage(value: unknown): value is HealthCheckMessage;
/**
 * Creates a validated HealthCheckMessage (request)
 */
export declare function createHealthCheckRequest(input: {
    targetAgentId: EntityId;
    sourceAgentId: EntityId;
    timestamp?: Timestamp;
    correlationId?: string;
}): HealthCheckMessage;
/**
 * Creates a validated HealthCheckMessage (response)
 */
export declare function createHealthCheckResponse(input: Omit<HealthCheckMessage, 'type' | 'timestamp' | 'isResponse'> & {
    timestamp?: Timestamp;
}): HealthCheckMessage;
/**
 * Generic message for backwards compatibility or custom types.
 */
export interface GenericMessage extends BaseMessageMeta {
    readonly type: 'generic';
    /** Message content/body */
    readonly content?: string;
    /** Custom data */
    readonly data?: Record<string, unknown>;
}
/**
 * Validates a GenericMessage
 */
export declare function isGenericMessage(value: unknown): value is GenericMessage;
/**
 * Creates a validated GenericMessage
 */
export declare function createGenericMessage(input: Omit<GenericMessage, 'type' | 'timestamp'> & {
    timestamp?: Timestamp;
}): GenericMessage;
/**
 * Union of all orchestrator message types
 */
export type OrchestratorMessage = TaskAssignmentMessage | StatusUpdateMessage | HelpRequestMessage | HandoffMessage | HealthCheckMessage | GenericMessage;
/**
 * Validates any orchestrator message
 */
export declare function isOrchestratorMessage(value: unknown): value is OrchestratorMessage;
/**
 * Parses a message from raw metadata
 */
export declare function parseMessageMetadata(metadata: unknown): OrchestratorMessage | null;
/**
 * Extracts message type from raw metadata
 */
export declare function getMessageType(metadata: unknown): MessageTypeValue | null;
/**
 * Validates message type value
 */
export declare function isMessageType(value: unknown): value is MessageTypeValue;
export {};
//# sourceMappingURL=message-types.d.ts.map