Reference
tRPC
Reference for @tailrace/trpc - createTailraceMiddleware, withTrpc, and TailraceTrpcOptions.
@tailrace/trpc provides procedure middleware for @trpc/server. It scans procedure input and result data at the tool boundary (not an OpenAI REST gateway).
Install
pnpm add @tailrace/core @tailrace/trpc @trpc/serverPeer dependency: @trpc/server >=10 (bound against @trpc/server@11.x). Depends on @tailrace/core + @tailrace/adapter (not @tailrace/http).
Exports
| Export | Description |
|---|---|
createTailraceMiddleware | Standalone middleware for t.procedure.use(...) |
withTrpc | Attach fluent middleware(...) to a Tailrace instance |
TailraceTrpcOptions | Options type |
TrpcMiddlewareContext | Context passed to option resolvers |
TailraceWithTrpc | Fluent instance type |
Options
| Option | Default | Notes |
|---|---|---|
agent | "default" | string or (info) => string |
name | procedure path | Tool name for the boundary |
workflowId | "default" | string or (info) => string |
onDecision | - | Audit callback |
Surfaces
| Surface | Boundary | Behavior |
|---|---|---|
| Input | { kind: "tool", name, direction: "out" } | check before next; rewrite input on tokenize/mask |
| Output | { kind: "tool", name, direction: "in" } | check ok result data; rewrite on tokenize/mask |
| Block | - | Throw TRPCError (BAD_REQUEST), value-free message |
Streaming procedures are out of scope in v0.1 (non-streaming queries/mutations only).