import type { RuntimeEventBus } from '../runtime/events/index.js'; import type { CommunicationKind, CommunicationScope } from '../../events/communication.js'; import { type AgentCommunicationMetadata } from './communication-policy.js'; export interface AgentMessage { id: string; from: string; to: string; content: string; timestamp: number; ttlMs: number; kind: CommunicationKind; scope: CommunicationScope; fromRole?: string | undefined; toRole?: string | undefined; cohort?: string | undefined; wrfcId?: string | undefined; parentAgentId?: string | undefined; } export type MessageCallback = (message: AgentMessage) => void; type MessageOptions = { /** * Caller-supplied message id. Lets a caller (e.g. ProcessRegistry.steer()) * learn the id synchronously from its own return value instead of from * send()'s boolean result. Defaults to a fresh crypto.randomUUID() when * omitted, existing callers are unaffected. */ id?: string | undefined; ttlMs?: number | undefined; kind?: CommunicationKind | undefined; scope?: CommunicationScope | undefined; cohort?: string | undefined; wrfcId?: string | undefined; parentAgentId?: string | undefined; }; export declare class AgentMessageBus { private messages; private subscriptions; private identities; private runtimeBus; setRuntimeBus(runtimeBus: RuntimeEventBus | null): void; registerAgent(meta: { agentId: string; template?: string | undefined; role?: AgentCommunicationMetadata['role'] | undefined; parentAgentId?: string | undefined; cohort?: string | undefined; wrfcId?: string | undefined; }): void; private resolveOptions; send(fromId: string, toId: string, content: string, ttlOrOptions?: number | MessageOptions): boolean; broadcast(fromId: string, content: string, ttlOrOptions?: number | MessageOptions): boolean; subscribe(agentId: string, callback: MessageCallback): () => void; getMessages(agentId: string): AgentMessage[]; private emitSent; private emitDelivered; private emitBlocked; /** Build the standard runtime event context for agent-communication bus events. */ private commContext; /** * Extract optional routing fields from options + sender/receiver metadata. * * Coalescing rules (intentionally asymmetric): * cohort, wrfcId , options ?? fromMeta ?? toMeta * parentAgentId , options ?? fromMeta ONLY (toMeta excluded to avoid * leaking the recipient's parent onto unrelated messages). */ private pickRoutingFields; cleanup(): void; private store; private deliver; } export {}; //# sourceMappingURL=message-bus-core.d.ts.map