/** * Send Message Tool Module - Built-in tool for dispatching message arrays to the active world/chat scope. * * Purpose: * - Expose a built-in `send_message` tool that dispatches one or more messages in order. * * Key Features: * - Accepts `messages` as `Array`. * - Injects trusted `worldId` and `chatId` from tool execution context. * - Ignores model-provided routing fields (`worldId`, `chatId`) for safety. * - Delegates human/user senders to queue-backed `enqueueAndProcessUserTurn`. * - Delegates assistant/tool/system senders to explicit immediate dispatch. * - Returns deterministic JSON-string summaries with per-item status. * * Implementation Notes: * - This tool does not claim downstream response completion; it reports dispatch/enqueue outcomes only. * - Root-level `worldId` and `chatId` are accepted for compatibility but never used for routing. * - Runtime routing requires explicit `context.chatId`; it does not fall back to `world.currentChatId`. * * Recent Changes: * - 2026-03-14: Routed `world` sender messages through the same queue-backed ingress as human/user turns. * - 2026-03-10: Split sender routing so queue-backed dispatch is user-only and non-user senders use immediate dispatch. * - 2026-03-04: Removed `world.currentChatId` fallback from trusted runtime routing; `context.chatId` is now required. * - 2026-03-04: Initial implementation of built-in `send_message` tool with trusted context injection. */ import type { World } from './types.js'; type SendMessageArgs = { messages?: unknown; worldId?: unknown; chatId?: unknown; }; type SendMessageContext = { world?: World; chatId?: string | null; }; export declare function createSendMessageToolDefinition(): { description: string; parameters: { type: string; properties: { messages: { type: string; description: string; items: { anyOf: ({ type: string; properties?: undefined; required?: undefined; additionalProperties?: undefined; } | { type: string; properties: { content: { type: string; }; sender: { type: string; }; }; required: string[]; additionalProperties: boolean; })[]; }; }; worldId: { type: string; description: string; }; chatId: { type: string; description: string; }; }; required: string[]; additionalProperties: boolean; }; execute: (args: SendMessageArgs, _sequenceId?: string, _parentToolCall?: string, context?: SendMessageContext) => Promise; }; export {};