/**
 * ComplexAgent Template — Tier 3 (Supervisor-Worker + Plan-and-Execute + Debate).
 *
 * Promoted from forge/src/agents/shared/templates/complex-agent.ts (Vague 1.B.7).
 *
 * For agents that need multi-agent coordination, step-by-step planning,
 * and adversarial debate:
 *   - Orchestrateur Central, Treasury Agent, DevOps Agent, Security Auditor,
 *     Contract Reviewer.
 *
 * Pattern: observe → orient (LLM + Debate) → decide (Plan decomposition) →
 *          act (execute steps) → reflect (self-critique, optional) → feedback.
 *
 * Differences from Forge template:
 * - AgentDependencies removed — uses AgentFactoryDeps (SDK-native)
 * - buildSkills / createForgeAgent replaced by createAgentFromConfig (SDK)
 * - Forge-specific couplings (slackWebhookUrl, litellmUrl) removed
 * - hitlEscalationLevel wired to AgentFactoryConfig (not Forge-specific gate)
 *
 * @public @since 0.20.0
 */
import { createAgentFromConfig } from "../factory/agent-factory.js";
// ─── Factory ──────────────────────────────────────────────────────────────────
/**
 * Create a Tier 3 (complex, supervisor-worker, debate-capable) OODA agent.
 *
 * Boilerplate reduction vs. raw `createAgentFromConfig`:
 * - HITL wiring handled automatically when `hitlEscalationLevel` is set
 * - Optional `reflect` phase wired correctly between act and feedback
 * - Phase `type` codes and `readOnly` flags set automatically
 *
 * @example
 * ```ts
 * const agent = await createComplexAgent<Obs, Orient, Plan, ExecResult, Feedback>(deps, {
 *   agentId: "treasury-agent",
 *   intervalMs: 3_600_000,
 *   observe: async () => ({ balance: 1000, pendingTx: [] }),
 *   orient: async (obs) => ({ recommendation: "hold", risk: "low" }),
 *   decide: async (orient) => ({ steps: [{ action: "record", data: orient }] }),
 *   act: async (plan) => ({ stepsExecuted: plan.steps.length }),
 *   feedback: async (result) => ({ success: result.stepsExecuted > 0 }),
 *   hitlEscalationLevel: "L3",
 * });
 * await agent.start();
 * ```
 *
 * @public
 */
export async function createComplexAgent(deps, opts) {
    return createAgentFromConfig(deps, {
        agentId: opts.agentId,
        agentVersion: opts.agentVersion ?? "0.1.0",
        intervalMs: opts.intervalMs,
        hitlEscalationLevel: opts.hitlEscalationLevel ?? "L3",
        sessionGuards: opts.sessionGuards,
        riskGuards: opts.riskGuards,
        outcomeMapping: opts.outcomeMapping,
        phases: {
            observe: {
                type: "observation",
                readOnly: true,
                fn: opts.observe,
            },
            orient: {
                type: "retrieval",
                readOnly: true,
                fn: opts.orient,
            },
            decide: {
                type: "decision",
                fn: opts.decide,
            },
            act: {
                type: "execution",
                hitlGate: opts.hitlEscalationLevel !== undefined,
                fn: opts.act,
            },
            ...(opts.reflect !== undefined
                ? {
                    reflect: {
                        type: "feedback",
                        readOnly: true,
                        fn: opts.reflect,
                    },
                }
                : {}),
            feedback: {
                type: "feedback",
                fn: opts.feedback,
            },
        },
    });
}
//# sourceMappingURL=complex-agent.js.map