Skip to content

v5.0: docs: fix V2 middleware result handling and add safe streaming guardrails - #21212

Merged
gr2m merged 1 commit into
release-v5.0from
documentation-fix-21209-20260920220415927899
Sep 22, 2026
Merged

gr2m merged 1 commit into
release-v5.0from
documentation-fix-21209-20260920220415927899

Conversation

@ai-sdk-factory

Copy link
Copy Markdown
Contributor

Background

On release-v5.0, middleware objects do not require a specification version, but the guardrails example still used invalid V2 result handling and left streaming redaction unimplemented, allowing matches split across deltas to bypass naive filtering.

Summary

Updated the middleware documentation and guardrail example to use V2 content results, buffer each text block independently until text-end, redact complete text, and document the latency, memory, and variable-length-pattern tradeoffs.

Testing

pnpm check, pnpm type-check:full, and pnpm --filter @example/ai-core type-check passed. A focused runtime probe passed all 25 tested chunk sizes and interleaved text blocks.

Related Issues

Fixes #21209

Co-authored-by: roshcompanylabs <[email protected]>
@gr2m
gr2m merged commit e944b5d into release-v5.0 Sep 22, 2026
48 checks passed
@gr2m
gr2m deleted the documentation-fix-21209-20260920220415927899 branch September 22, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants