/** * Create Agent Tool Module - Built-in tool for approval-gated agent creation * * Purpose: * - Expose a built-in `create_agent` tool that creates one new agent after explicit user approval. * * Key Features: * - Requires `name` and supports optional `autoReply`, `role`, and `nextAgent` inputs. * - Enforces HITL approval with deterministic deny/timeout handling before persistence. * - Generates deterministic system prompt text for multi-agent routing. * - Uses world-level chat provider/model settings with deterministic fallbacks. * * Implementation Notes: * - Uses manager-level `createAgent` as the persistence boundary. * - Returns deterministic JSON-string payloads for success, denial, and errors. * - Keeps runtime contract canonical (`autoReply`, `nextAgent`) while aliases are handled upstream. * * Recent Changes: * - 2026-03-12: Shared tool approval flow now persists durable approval prompt/resolution messages for replay-safe denial history. * - 2026-03-12: Added `read` permission level guard — returns a blocked-tool error when world toolPermission is 'read'. * - 2026-02-20: Added post-create HITL informational confirmation (`Agent has been created`) with `refreshAfterDismiss` metadata set to true. * - 2026-02-20: Pre-claim agent creation slot before approval dialog to prevent parallel-call race where both calls pass approval before either calls createAgent. * - 2026-02-20: Updated tool create path to allow manager-level create during the current in-flight world processing turn. * - 2026-02-20: Updated `create_agent` default behavior so omitted `autoReply` resolves to `false`. * - 2026-02-20: Added initial built-in `create_agent` tool implementation with mandatory approval gate. */ import { type World } from './types.js'; type CreateAgentToolArgs = { name?: unknown; autoReply?: unknown; role?: unknown; nextAgent?: unknown; }; type CreateAgentToolContext = { world?: World; chatId?: string | null; messages?: Array>; toolCallId?: string; agentName?: string | null; }; export declare function createCreateAgentToolDefinition(): { description: string; parameters: { type: string; properties: { name: { type: string; description: string; }; autoReply: { type: string; description: string; }; role: { type: string; description: string; }; nextAgent: { type: string; description: string; }; }; required: string[]; additionalProperties: boolean; }; execute: (args: CreateAgentToolArgs, _sequenceId?: string, _parentToolCall?: string, context?: CreateAgentToolContext) => Promise; }; export {};