Anchorage API reference
    Preparing search index...

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

    Under the supported @mastra/core peer, a final output result has no structured-object field. The constructor therefore requires an audit sink when a policy selects object without answer. A final-result call fails closed unless this engine actually evaluated an object chunk. Policies that include answer inspect JSON carried as answer text.

    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.

    Accessors

    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>