/** * Subscribers Module * * Provides event subscription handlers for agents and world. * Handles message routing, tool result processing, and world activity tracking. * * Features: * - Agent message subscription with automatic response processing * - Tool message subscription with security checks * - World message subscription: idempotent wrapper for world-level message listeners. * - World activity listener: idempotent wrapper — no-op when setupEventPersistence has run; * standalone fallback path delegates idle-title logic to title-scheduler.ts. * * Dependencies (Layer 6): * - types.ts (Layer 1) * - publishers.ts (Layer 3) * - persistence.ts, memory-manager.ts, title-scheduler.ts (Layer 4) * - orchestrator.ts (Layer 5) * - utils.ts, logger.ts * * Changes: * - 2026-03-10: Removed standalone world-message title scheduling so idle activity is the sole * automatic chat-title trigger. * - 2026-03-06: Removed `world.currentChatId` fallback from world-message title scheduling; chat-scoped handlers now require explicit `event.chatId`. * - 2026-03-03: Removed private title-scheduling logic (moved to title-scheduler.ts Layer 4). * subscribeWorldToMessages and setupWorldActivityListener are now idempotent wrappers that * short-circuit when setupEventPersistence has already registered a combined handler. * - 2026-02-28: Made world message subscription idempotent. * - 2026-02-22: Persist incoming human messages to agent memory even when agents do not respond. * - 2026-02-20: Publish chat-title update notifications as structured `system` events. * - 2025-11-09: Extracted from events.ts for modular architecture. */ import type { World, Agent } from '../types.js'; /** * Agent subscription with automatic message processing */ export declare function subscribeAgentToMessages(world: World, agent: Agent): () => void; /** * Subscribe world to messages with cleanup function */ export declare function subscribeWorldToMessages(world: World): () => void; /** * Setup world activity listener for idle-triggered chat title updates. * Idempotent — returns existing cleanup handle if setupEventPersistence already registered * a combined 'world' handler for this world. */ export declare function setupWorldActivityListener(world: World): () => void;