Anchorage API reference
    Preparing search index...

    Mastra Processor implementing input/output policy gating — see the module comment for the phase/channel model.

    Under @mastra/core 1.50, a final output result has no structured-object field. The constructor therefore requires an audit sink when a policy selects object without answer. The first final-result call then emits one coverage warning for that engine instance. Policies that include answer inspect the JSON text emitted by direct structured output.

    The constructor also rejects an explicit input policy whose channels exclude answer, because input evaluation has no other channel.

    Implements

    • Processor<"breakwater-policy-engine">
    Index

    Constructors

    Properties

    id: "breakwater-policy-engine" = ...

    Stable Mastra processor identifier.

    Methods

    • Process input messages before they are sent to the LLM

      Parameters

      • args: ProcessInputArgs

      Returns Promise<ProcessInputResult>

      Either:

      • MessageList: The same messageList instance passed in (indicates you've mutated it)
      • MastraDBMessage[]: Transformed messages array (for simple transformations)
      • { messages, systemMessages }: Object with both messages and modified system messages
    • Process the complete output result after streaming/generate is finished

      Parameters

      • args: ProcessOutputResultArgs

      Returns Promise<MastraDBMessage[]>

      Either:

      • MessageList: The same messageList instance passed in (indicates you've mutated it)
      • MastraDBMessage[]: Transformed messages array (for simple transformations)
    • Process output stream chunks with built-in state management This allows processors to accumulate chunks and make decisions based on larger context Return null or undefined to skip emitting the part

      Parameters

      • args: ProcessOutputStreamArgs

      Returns Promise<ChunkType | null | undefined>