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 fastifyPeer dependency: fastify >=4. Depends on @tailrace/core + @tailrace/http.
Exports
| Export | Description |
|---|---|
tailraceFastify | Returns a Fastify plugin |
TailraceFastifyOptions | Options type |
Options
| Option | Default | Notes |
|---|---|---|
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.