/**
 * agent — Delegate tasks to a sub-agent.
 *
 * Inspired by VS Code Copilot's runSubagent + search_subagent:
 * - `prompt` + `description` + `details` for clear task specification
 * - `allowedTools` for scoping what the sub-agent can do
 * - `maxRounds` to limit autonomous tool-calling loops
 *
 * Our advantage: single unified agent tool instead of Copilot's two
 * separate tools (runSubagent + search_subagent).
 */
import { createAgentSpawnTool } from "../agent-tools.js";
export function createAgentTool(deps) {
    const inner = createAgentSpawnTool(deps);
    return {
        name: "agent",
        description: "Launch a sub-agent for complex, multi-step tasks. " +
            "It gets its own tools, works autonomously, and returns a single result. " +
            "Provide a detailed prompt specifying exactly what to do and return.",
        tier: "core",
        category: "agent",
        source: "builtin",
        parameters: {
            type: "object",
            properties: {
                prompt: {
                    type: "string",
                    description: "Detailed task description for the agent.",
                },
                description: {
                    type: "string",
                    description: "Short (3-5 word) task label.",
                },
                details: {
                    type: "string",
                    description: "Additional context and expected return format.",
                },
                allowedTools: {
                    type: "string",
                    description: "Comma-separated tool names (default: read,search,execute,web).",
                },
                maxRounds: {
                    type: "number",
                    description: "Max tool-calling rounds (default: 8).",
                },
            },
            required: ["prompt", "description"],
        },
        async execute(input, context) {
            return inner.execute(input, context);
        },
    };
}
//# sourceMappingURL=agent.js.map