Tailrace
Reference

Fastify

Reference for @tailrace/fastify - tailraceFastify plugin and TailraceFastifyOptions.

@tailrace/fastify provides an OpenAI-compatible Fastify plugin. It scans chat request bodies and JSON / SSE responses at the model boundary via preHandler and onSend / stream wrapping.

Install

pnpm add @tailrace/core @tailrace/fastify fastify

Peer dependency: fastify >=4. Depends on @tailrace/core + @tailrace/http.

Exports

ExportDescription
tailraceFastifyReturns a Fastify plugin
TailraceFastifyOptionsOptions type

Options

OptionDefaultNotes
mode"openai-compatible"Only mode in v0.1
agent"default"(req) => string
workflowId"default"string or (req) => string
onDecision-Audit callback

Boundary provider is the request body's model string as-is (no ${providerId}/${modelId} rewrite).

Block shape

422 JSON { error: { type: "policy_violation", entity, rule } }. SSE: one data: error event then close (abort-equivalent only). Maps from PolicyViolationError.

See also

On this page