/** * `defaultPipeline()` — pre-wires the canonical 4-step pipeline * (intent → policy → LLM → audit) with sensible defaults. * * Each step is optional: * - intent omitted ⇒ pipeline skips classification (decision.intent stays null) * - policy omitted ⇒ no gating (anything proceeds) * - audit omitted (no emit) ⇒ no agent_decision event, but the pipeline * still runs to completion * * Bots that want more control can build the pipeline manually: * new AgentPipeline([myIntent, myPolicy, myLLM, myAudit]) */ import { AgentPipeline } from './pipeline.js'; import { LLMResponder, type LLMResponderOptions } from './llm.js'; import { AuditEmitter } from './audit.js'; import type { LLMIntentClassifier } from './intent.js'; import type { PolicyGate } from './policy.js'; import type { Emit } from '../events/emit.js'; import type { PipelineContext, PipelineStep } from './types.js'; export interface DefaultPipelineOptions extends Omit { intent?: LLMIntentClassifier | PipelineStep; policy?: PolicyGate | PipelineStep; emit?: Emit; } export function defaultPipeline({ intent, policy, emit, ...llmOpts }: DefaultPipelineOptions): AgentPipeline { const steps: PipelineStep[] = []; if (intent) steps.push(intent as PipelineStep); if (policy) steps.push(policy as PipelineStep); steps.push(new LLMResponder(llmOpts) as PipelineStep); if (emit) steps.push(new AuditEmitter({ emit }) as PipelineStep); return new AgentPipeline(steps); }